Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Gulp: Images minificaiton task
/**
* Images
*
* Look at src/images, optimize the images and send them to the appropriate place
*/
gulp.task('images', function() {
// Add the newer pipe to pass through newer images only
return gulp.src(['./assets/img/raw/**/*.{png,jpg,gif}'])
.pipe(newer('./assets/img/'))
.pipe(rimraf({ force: true }))
.pipe(imagemin({ optimizationLevel: 7, progressive: true, interlaced: true }))
.pipe(gulp.dest('./assets/img/'))
.pipe( notify( { message: 'Images task complete', onLast: true } ) );
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment