@democrance/imagemin-lint-staged

5.0.0 • Public • Published

@democrance/imagemin-lint-staged

package version package downloads package license

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

Usage

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.

License

MIT © Daniil Chumachenko

Readme

Keywords

Package Sidebar

Install

npm i @democrance/imagemin-lint-staged

Weekly Downloads

153

Version

5.0.0

License

MIT

Unpacked Size

500 kB

Total Files

30

Last publish

Collaborators

  • daniil4udo