Skip to content

Instantly share code, notes, and snippets.

@jeffreysbrother
Created March 19, 2016 06:53
Show Gist options
  • Save jeffreysbrother/d8b059c03b5748b9579e to your computer and use it in GitHub Desktop.
Save jeffreysbrother/d8b059c03b5748b9579e to your computer and use it in GitHub Desktop.
grunt-contrib-imagemin with additional plugin
module.exports = function(grunt) {
//additional plugin installed:
var mozjpeg = require('imagemin-mozjpeg');
//project configuration
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
imagemin: {
jpg: {
options: {
progressive: true,
use: [mozjpeg()],
quality: 10
},
files: [{
expand: true,
cwd: 'img/',
src: ['**/*.{png,jpg,gif}'],
dest: 'img/compressed/'
}]
}
}
});
//load the plugin
grunt.loadNpmTasks('grunt-contrib-imagemin');
//default task(s)
// grunt.registerTask('default', ['imagemin']);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment