Skip to content

Instantly share code, notes, and snippets.

@sim2github
Forked from ahmadawais/gulpfile.js
Created November 20, 2017 03:55
Show Gist options
  • Save sim2github/f1a9b77de7edc7f8488eff837506996e to your computer and use it in GitHub Desktop.
Save sim2github/f1a9b77de7edc7f8488eff837506996e to your computer and use it in GitHub Desktop.
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