Skip to content

Commit

Permalink
Added config example to node example file
Browse files Browse the repository at this point in the history
There is (understandably) some confusion about how the config files works (see svg#439) so I've added an example (the one given in that issue) in place of a fairly useless placeholder
  • Loading branch information
lightlii authored Feb 7, 2018
1 parent c47c71b commit 3ec6cef
Showing 1 changed file with 73 additions and 1 deletion.
74 changes: 73 additions & 1 deletion examples/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,79 @@ var FS = require('fs'),
PATH = require('path'),
SVGO = require('../lib/svgo'),
filepath = PATH.resolve(__dirname, 'test.svg'),
svgo = new SVGO(/*{ custom config object }*/);
svgo = new SVGO({
plugins: [{
cleanupAttrs: true,
}, {
removeDoctype: true,
},{
removeXMLProcInst: true,
},{
removeComments: true,
},{
removeMetadata: true,
},{
removeTitle: true,
},{
removeDesc: true,
},{
removeUselessDefs: true,
},{
removeEditorsNSData: true,
},{
removeEmptyAttrs: true,
},{
removeHiddenElems: true,
},{
removeEmptyText: true,
},{
removeEmptyContainers: true,
},{
removeViewBox: false,
},{
cleanUpEnableBackground: true,
},{
convertStyleToAttrs: true,
},{
convertColors: true,
},{
convertPathData: true,
},{
convertTransform: true,
},{
removeUnknownsAndDefaults: true,
},{
removeNonInheritableGroupAttrs: true,
},{
removeUselessStrokeAndFill: true,
},{
removeUnusedNS: true,
},{
cleanupIDs: true,
},{
cleanupNumericValues: true,
},{
moveElemsAttrsToGroup: true,
},{
moveGroupAttrsToElems: true,
},{
collapseGroups: true,
},{
removeRasterImages: false,
},{
mergePaths: true,
},{
convertShapeToPath: true,
},{
sortAttrs: true,
},{
transformsWithOnePath: false,
},{
removeDimensions: true,
},{
removeAttrs: {attrs: '(stroke|fill)'},
}]
});

FS.readFile(filepath, 'utf8', function(err, data) {

Expand Down

0 comments on commit 3ec6cef

Please sign in to comment.