create sprite images from css files
$ npm install --save-dev sprites-preprocessor
var sprites = require('sprites-preprocessor');
var options = {
name: 'sprite.png',
path: 'images/sprites',
prefix: '/images/sprites/'
};
sprites(options, 'body { background: url(/images/sprite/file.png); }', function(err, css, image) {
// code
});
For gulp tasks there is gulp plugin gulp-sprite-preprocessor
Type: String
Default: sprite.png
Name of the output sprite file.
Type: String
Default: images/sprites
Path to the source image files
Type: String
Default: /images/sprites/
Css prefix in image url to know what images transform into sprites