Skip to content

Instantly share code, notes, and snippets.

@jessehattabaugh
Last active August 29, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jessehattabaugh/5e3b31a0fc20598dff20 to your computer and use it in GitHub Desktop.
Save jessehattabaugh/5e3b31a0fc20598dff20 to your computer and use it in GitHub Desktop.
gulp image compression task with gulp-watch
/* Images
******************************************************************************/
gulp.task('images', function() {
// batch mode
watch({glob: './source/images/*'})
.pipe(plumber())
.pipe(imagemin({
progressive: true,
interlaced: true
}))
.pipe(gulp.dest('./www'));
// The gulp-watch docs said I could also run on each individual file like this, but it doens't work either
//gulp.src('source/images/*', {read: false})
// .pipe(watch())
// .pipe(plumber())
// .pipe(imagemin({
// progressive: true,
// interlaced: true
// }))
// .pipe(gulp.dest('./www'));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment