Created
March 19, 2016 06:53
-
-
Save jeffreysbrother/d8b059c03b5748b9579e to your computer and use it in GitHub Desktop.
grunt-contrib-imagemin with additional plugin
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
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