Skip to content

Instantly share code, notes, and snippets.

@patrickposner
Created April 23, 2018 05:49
Show Gist options
  • Select an option

  • Save patrickposner/9866b4a08fc7b4947d1205c6094cd3f7 to your computer and use it in GitHub Desktop.

Select an option

Save patrickposner/9866b4a08fc7b4947d1205c6094cd3f7 to your computer and use it in GitHub Desktop.
const mozjpeg = require('imagemin-mozjpeg');
grunt.initConfig({
imagemin: {
static: {
options: {
optimizationLevel: 3,
svgoPlugins: [{removeViewBox: false}],
use: [mozjpeg()] // Example plugin usage
},
files: {
'dist/img.png': 'src/img.png',
'dist/img.jpg': 'src/img.jpg',
'dist/img.gif': 'src/img.gif'
}
},
dynamic: {
files: [{
expand: true,
cwd: 'src/',
src: ['**/*.{png,jpg,gif}'],
dest: 'dist/'
}]
}
}
});
grunt.loadNpmTasks('grunt-contrib-imagemin');
grunt.registerTask('default', ['imagemin']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment