grunt-guetzli

1.0.0 • Public • Published

grunt-guetzli

Grunt plugin to compress JPG and PNG images according to Google's Guetzli algorithm.

npm version Build Status Scrutinizer Code Quality npm

grunt-guetzli in action

Installation

You need to have Guetzli already installed on your system for this plugin to work. Download from the Guetzli releases page, or compile it yourself.

Run npm install --save grunt-guetzli.

This will install the grunt-guetzli plugin and its grunt dependency if not already installed.

In your Gruntfile.js , you can use the new guetzli task as following:

guetzli: {
            files: {
                expand: true,
                src: 'tmp/images/*.jpg',
                dest: 'tmp/images-optimized'
            },
            options: {
                quality: 84
            }
        }

Don't forget to load the plugin as well:

grunt.loadNpmTasks('grunt-guetzli');

Configuration

The source guetzli binary does not expose many configuration options other than the quality and an option to enable verbose output. Currently, Guetzli binary also exposes an option to limit the memory limit, and those options will be added to this grunt plugin in a future release.

This plugin makes it possible to configure the quality, verbose option, and specify the guetzli binary path if it's not in the system PATH.

Configuration options

  • quality: The quality of the output image. Allows an integer between 84 and 100. Default (from guetzli binary): 95.
  • verbose: Enables verbose output from the guetzli binary. Note that this plugin provides the compression information for each file, and a summary at the end of operation even without this option.
  • binpath: Specify a custom path to the guetzli binary if it is not already available in the path. If not given, guetzli will be used. If the given path is not available or executable, Grunt will return an error with code 127.

Contributing

You are welcome to do so. Send a PR or create an issue in the Github repo.

Package Sidebar

Install

npm i grunt-guetzli

Weekly Downloads

2

Version

1.0.0

License

MIT

Last publish

Collaborators

  • ayesh