grunt-mega-image

2.4.0 • Public • Published

grunt-image

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

Install

$ npm install --save-dev grunt-mega-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,
          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

Dependencies (21)

Dev Dependencies (4)

Package Sidebar

Install

npm i grunt-mega-image

Weekly Downloads

4

Version

2.4.0

License

MIT

Unpacked Size

573 kB

Total Files

14

Last publish

Collaborators

  • dimitarkolev