designed for lint-staged usage with sensible defaults,but CLI calls are also supported.
Automatically optimize images on submission
npm i --save-dev squoosh-lint-staged
squoosh-lint-staged 1.png 2.png
, Replacement of original positionsquoosh-lint-staged -T ./images
, Replace the original location in the foldersquoosh-lint-staged -T ./images -O ./newImages/
, Output to new directorysquoosh-lint-staged -O ./newImages/ 1.png 2.png
, Output to new directory- use width lint-staged
"lint-staged": {
"*.{png,jpg,webp}": ["squoosh-lint-staged", "git add"]
}
Other formats are not supported at the moment(gif),Please change JPEG to jpg
use node v10.5.0 or above。