0.1.0 • Published 5 years ago

hermione-image-minifier v0.1.0

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

hermione-image-minifier

NPM version Build Status

Plugin for hermione to minificate reference images (uses optipng).

Installation

npm install hermione-image-minifier

Configuration

Plugin has following configuration:

  • enabled (optional) Boolean – enable/disable the plugin; by default plugin is enabled
  • compressionLevel (optional) Number - compression level from 0 to 7; by default 2

Also there is ability to override plugin parameters by CLI options or environment variables (see configparser). Use hermione_image_minifier_ prefix for the environment variables and --hermione-image-minifier- for the cli options.

Usage

Add plugin to your hermione config file:

module.exports = {
    // ...
    system: {
        plugins: {
            'hermione-image-minifier': {
                enabled: true,
                compressionLevel: 7 // maximal compression, but takes the most time
            }
        }
    },
    //...
}

Debug mode

To turn on debug mode set DEBUG=hermione:image-minifier enviroment variable:

$ DEBUG=hermione:image-minifier ./node_modules/.bin/hermione --update-refs

Console output:

/path/to/reference/image.png compressed by 30%