Minify SVG using SVGO
Issues with the output should be reported on the SVGO issue tracker.
npm install --save-dev grunt-svgmin
require('load-grunt-tasks')(grunt);
grunt.initConfig({
svgmin: {
options: {
plugins: [
{
name: 'preset-default',
params: {
overrides: {
sortAttrs: false
}
}
}
]
},
dist: {
files: {
'dist/unicorn.svg': 'app/unicorn.svg'
}
}
}
});
grunt.registerTask('default', ['svgmin']);
The provided options are passed directly to SVGO.
Per-file savings are only printed in verbose mode (grunt svgmin --verbose
).