Skip to content

Instantly share code, notes, and snippets.

@peazz
Forked from gaspanik/gulpfile.js
Created April 1, 2017 01:14
Show Gist options
  • Save peazz/652d3da1afd136955eeac3cbbcd0550f to your computer and use it in GitHub Desktop.
Save peazz/652d3da1afd136955eeac3cbbcd0550f to your computer and use it in GitHub Desktop.
automate optimize images w/ gulp
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