lint-staged-imagemin

1.3.0 • Public • Published

lint-staged-imagemin

package version package downloads standard-readme compliant package license make a pull request

Easily configure imagemin to work with lint-staged

Table of Contents

Install

Install the package locally within you project folder with your package manager:

$ npm install -D lint-staged-imagemin

You also need to install the default plugins unless you explicity want to override them:

$ npm install -D imagemin-gifsicle imagemin-mozjpeg imagemin-svgo imagemin-optipng

Usage

Configure with lint-staged:

{
    "lint-staged": {
        "*.{png,jpeg,jpg,gif,svg}": ["lint-staged-imagemin"]
    },
}

The package uses cosmiconfig with the module name imagemin to allow you to configure the imagemin plugins. Add the following to your package.json

{
    "imagemin": {
        "optipng": {
            "optimizationLevel": 5
        },
    }
}

Your configuration will be merged with the default configuration. If you would like to remove one of the default plugins, add the value of null and it will be ignored.

{
    "imagemin": {
        "optipng": null,
        "pngout": {}
    }
}

Remember to install the imagemin plugins you use. You'll get a warning if their is configuration, but the plugin is missing.

If you would like to get more details about the savings, add the --verbose flag to lint-staged.

Contributing

Got an idea for a new feature? Found a bug? Contributions are welcome! Please open up an issue or make a pull request.

License

MIT © Tiaan du Plessis

Readme

Keywords

Package Sidebar

Install

npm i lint-staged-imagemin

Weekly Downloads

10

Version

1.3.0

License

MIT

Unpacked Size

65.5 kB

Total Files

8

Last publish

Collaborators

  • tiaanduplessis