-
-
Save nfroidure/6d11aa959329e575215a 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 clone = require('gulp-clone'); | |
gulp.task("default", function() { | |
var normal = gulp.src( destination + '*.png' ); | |
var retina = normal.pipe(clone()); | |
normal.pipe(makeSprites()) | |
.pipe(gulp.dest( imagesBase + '1x/' )); | |
retina.pipe(makeSprites('retina')) | |
.pipe(gulp.dest( imagesBase + '2x/' )); | |
}); | |
function makeSprites(nameExtension) { | |
var name = 'sprite'; | |
if( typeof( nameExtension ) !== 'undefined' ) { | |
name += '-' + nameExtension; | |
} | |
return sprite({ | |
name: name, | |
style: '_' + name + '.scss', | |
cssPath: imagesBase, | |
processor: 'scss' | |
}) | |
.pipe(imagemin({ | |
optimizationLevel: 5, | |
progressive: true, | |
interlaced: true | |
})); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment