lint-staged-imagemin
v1.3.0
Published
Easily configure imagemin to work with lint-staged
Downloads
67
Readme
lint-staged-imagemin
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.