Giter Site home page Giter Site logo

grunt-guetzli's Introduction

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
            }
        }

Then, you need to make Grunt load the new task:

grunt.loadNpmTasks('grunt-guetzli');

Now, you can add the grunt-guetzli to any existing or new Grunt task:

grunt.registerTask('default', ['uncss', 'concat_css', 'uglify', 'guetzli']); // Notice the last array element.

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.

grunt-guetzli's People

Contributors

ayesh avatar humantorch avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

humantorch

grunt-guetzli's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.