husky-imagemin

optimize newly added large images before commit

View on GitHub

husky-imagemin

automatically optimize newly added image before commit

NPM JavaScript Style Guide Downloads/week

Install

npm install husky-imagemin --save-dev
or
yarn add husky-imagemin -D

How to use

Basic usage

add command to husky hooks config, if already use lint-stage, you can use && to concat husky-imagemin

"husky": {
    "hooks": {
        "pre-commit": "lint-staged && husky-imagemin"
    }
}

Custom usage

you can specific large image definination by pass parameter to husky-imagemin, default large image definination is > 50kb

"husky": {
    "hooks": {
        "pre-commit": "lint-staged && husky-imagemin --size=100"
    }
}

Support or Contact

Feel free to create issue or make pr to contribute