coveo-png-sprite
v1.0.1
Published
Gulp task that converts images to sprites+css
Downloads
12
Readme
coveo-png-sprite
coveo-png-sprite is a gulp module that creates sprite sheets from multiple images
var gulp = require('gulp');
var pngSprite = require('coveo-png-sprite');
gulp.task('buildSprites', function (done) {
return gulp.src('img/**/*.png')
.pipe(pngSprite.gulp({
cssPath: 'sprites.scss',
pngPath: 'sprites.png',
namespace: 'sprites'
}))
.pipe(gulp.dest('./target/'))
});
var fs = require('fs');
var Sprite = require('coveo-png-sprite').Sprite;
var sprite = new Sprite();
sprite.addImageSrc([
"./img/a.png",
"./img/b.png",
"./img/c.png",
"./img/d.png"
], function(){
var obj = sprite.compile('./sprite.png');
obj.png.pipe(fs.createWriteStream('sprite.png'));
fs.writeFile('sprite.css', obj.css);
});