JavaScript
Latest commit bb36117 Apr 21, 2017 @1000ch 2.3.0
Permalink
Failed to load latest commit information.
lib Add guetzli integration Apr 21, 2017
screenshot remove shadow Mar 18, 2014
tasks Add guetzli integration Apr 21, 2017
test Fully refactored Jul 17, 2016
.gitignore update files Jan 26, 2014
.travis.yml Remove a test case for Node.js v5 Apr 21, 2017
gruntfile.js Fully refactored Jul 17, 2016
license Update license Mar 17, 2017
package.json 2.3.0 Apr 21, 2017
readme.md Add guetzli integration Apr 21, 2017

readme.md

grunt-image

Optimize PNG, JPEG, GIF, SVG images with grunt task.

Build Status NPM version Dependency Status devDependency Status

Install

$ npm install --save-dev grunt-image

Usage

This is an example of gruntfile.js.

module.exports = function (grunt) {
  grunt.initConfig({
    image: {
      static: {
        options: {
          pngquant: true,
          optipng: false,
          zopflipng: true,
          jpegRecompress: false,
          jpegoptim: true,
          mozjpeg: true,
          guetzli: false,
          gifsicle: true,
          svgo: true
        },
        files: {
          'dist/img.png': 'src/img.png',
          'dist/img.jpg': 'src/img.jpg',
          'dist/img.gif': 'src/img.gif',
          'dist/img.svg': 'src/img.svg'
        }
      },
      dynamic: {
        files: [{
          expand: true,
          cwd: 'src/',
          src: ['**/*.{png,jpg,gif,svg}'],
          dest: 'dist/'
        }]
      }
    }
  });

  grunt.loadNpmTasks('grunt-image');
};

options attributes are optional. If you don't want to set as optimizer, set false. When you omitted, the optimizer will be applied.

Result

License

MIT © Shogo Sensui