Skip to content

Instantly share code, notes, and snippets.

@jdsteinbach
Last active January 25, 2016 16:18
Show Gist options
  • Select an option

  • Save jdsteinbach/24fad0ef9f8455fe134d to your computer and use it in GitHub Desktop.

Select an option

Save jdsteinbach/24fad0ef9f8455fe134d to your computer and use it in GitHub Desktop.
(function() {
'use strict';
var _img_src_dir = '/src/img/';
var _img_dir = '/img/';
/**
* Minimizes all the images
*/
gulp.task('images', function() {
var _options = {
progressive: true,
svgoPlugins: [{
removeViewBox: false,
removeHiddenElems: false
}]
};
gulp.src(_img_src_dir + '/*.{png,jpg,jpeg,gif,svg}')
.pipe($.changed(_img_dir))
.pipe($.imagemin(_options))
.pipe(gulp.dest(_img_dir))
);
});
}());
"devDependencies": {
"gulp-changed": "^1.2.1",
"gulp-imagemin": "^2.2.1"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment