-
-
Save peazz/652d3da1afd136955eeac3cbbcd0550f to your computer and use it in GitHub Desktop.
automate optimize images w/ gulp
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
var gulp = require('gulp') | |
, imagemin = require('gulp-imagemin'); | |
var paths = { | |
srcDir: 'src/*', | |
destDir: 'images' | |
} | |
gulp.task('imagemin', function() { | |
gulp.src(paths.srcDir) | |
.pipe(imagemin()) | |
.pipe(gulp.dest(paths.destDir)); | |
}); | |
gulp.task('default', function() { | |
gulp.run('imagemin'); | |
gulp.watch(paths.srcDir, function() { | |
gulp.run('imagemin'); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment