5.0.0 • Published 9 months ago
@democrance/imagemin-lint-staged v5.0.0
@democrance/imagemin-lint-staged
Easily configure imagemin to work with lint-staged
Table of Contents
Install
Install the package locally within you project folder with your package manager:
$ pnpm install -D @democrance/imagemin-lint-stagedUsage
Configure with lint-staged:
{
"lint-staged": {
"*.{png,jpeg,jpg,gif,svg}": ["imagemin-lint-staged"]
}
}The package uses cosmiconfig with the module name imagemin to allow you to configure the sharp and SVGO plugins. Add the following to your package.json
{
"imagemin": {
// Configuration for Sharp image optimization
"$sharp": {
"progressive": true,
"quality": 90,
"nearLossless": true,
"effort": 6,
"compressionLevel": 9,
"force": false
// Add additional Sharp configurations here...
},
// Configuration for SVGO optimization
"$svgo": {
"multipass": true
// Add additional SVGO configurations here...
},
// Library defaults
// Minimum difference between minified & original files to trigger saving
"skipDelta": 500,
// Ignore errors during minification process
"silentErrors": false,
// Print information about saved bytes
"showSavings": true
}
}Your configuration will be merged with the default configuration.
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.