metalsmith-svgo
Compress SVG with Metalsmith.
If you have any issues with the output of this plugin, please use the svgo tracker.
With npm do:
npm install metalsmith-svgo --save
var svgo = require('metalsmith-svgo'),
Metalsmith = require('metalsmith');
Metalsmith('fixtures')
.use(svgo())
.build(function (err) {
if (err) {
throw err;
}
});
With custom options:
Metalsmith('fixtures')
.use(svgo({
plugins: [{
removeDoctype: false
}, {
removeComments: false
}, {
cleanupNumericValues: {
floatPrecision: 2
}
}, {
convertColors: {
names2hex: false,
rgb2hex: false
}
}]
}))
.build(function (err) {
if (err) {
throw err;
}
});
See the svgo documentation.
Pull requests are welcome. If you add functionality, then please add unit tests to cover it.
MIT © Ben Briggs