grunt-svg-compactor
Turns a folder of SVG files into a single .css file using data-uri.
This npm package is originally based on SVG-Stacker [https://github.com/preciousforever/SVG-Stacker]. The whole difference is it not generate any stacked svg file, but only one .css file referencing svg paths directly in classes, so it's ready to use whithout the need of javascript. Also, it uses 'cheerio' instead of 'libxmljs' for DOM manipulations to work on windows platform.
The idea is largely inspired from the grunticon project, that you should use if you plan to deserve old browsers with png fallback. In fact, the main difference with grunticon, is that the generated css file includes default width/height for each asset.
usage :
grunt.loadNpmTasks('grunt-svg-compactor');
svgcompactor: {
all: {
source: '<%= dirs.svgsrc %>/min-assets',
target: '<%= dirs.svgsrc %>',
outputname: 'stack'
}
}