Created
January 11, 2016 15:02
-
-
Save keelii/73f5fb6e387d3a45d042 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var gulp = require('gulp'); | |
var spritesmith = require('gulp.spritesmith'); | |
var imageminPngquant = require('imagemin-pngquant'); | |
var buffer = require('vinyl-buffer'); | |
var rename = require("gulp-rename"); | |
module.exports = function (config) { | |
var sprite = config.sprite; | |
return function (cb) { | |
cb = cb || function() {}; | |
gulp.src(sprite.src) | |
.pipe(spritesmith({ | |
imgName: sprite.imgName, | |
cssName: sprite.cssName | |
})) | |
.pipe(gulp.dest(sprite.dest)) | |
.pipe(buffer()) | |
.pipe(rename(function (path) { | |
//path.dirname += '/i'; | |
path.basename += '_8'; | |
path.extname = '.png' | |
})) | |
.pipe(imageminPngquant({quality: '65-80', speed: 4})()) | |
.pipe(gulp.dest(sprite.dest)) | |
.on('end', cb); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment