Created
April 23, 2018 05:49
-
-
Save patrickposner/9866b4a08fc7b4947d1205c6094cd3f7 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| 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