Skip to content

Instantly share code, notes, and snippets.

@nfroidure
Forked from Simounet/gulpfile.js
Last active August 29, 2015 14:16
Show Gist options
  • Save nfroidure/6d11aa959329e575215a to your computer and use it in GitHub Desktop.
Save nfroidure/6d11aa959329e575215a to your computer and use it in GitHub Desktop.
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