Last active
August 29, 2015 14:02
-
-
Save jessehattabaugh/5e3b31a0fc20598dff20 to your computer and use it in GitHub Desktop.
gulp image compression task with gulp-watch
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
/* 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