0.1.6 • Published 3 months ago
optimage-cli v0.1.6
Optimage
Installation
npm install -D optimage-cli
Usage
npx optimage-cli "{path}" "{ignore}" [--config=path/to/config.json]
Argument
Argument | Description | Example |
---|---|---|
path | A Glob pattern that match all files to optimize. | "images/**/*.@(png|jpg|jpeg|gif|webp)" |
ignore | A Glob pattern that match files to ignore. | "images/raw/*" |
Options
Option | Description | Example |
---|---|---|
--config | Relative or absolute path the a JSON config file. | optimage.json |
Example usage
node optimage "images/**/*.@(png|jpg|jpeg|gif|webp)" "images/raw/**/*" --config=optimage.json
Optimize all png and jpeg image files in ./images
exept those in the ./images/raw
folder using configuration from optimage.json
.
Configuration
Entry | Description |
---|---|
cache | Sharp cache configuration |
options | Sharp images options (applied to all formats) |
jpeg | Sharp jpeg options |
png | Sharp png options |
webp | Sharp webp options |
gif | Sharp gif options |
Example configuration
optimage.json
:
{
"cache": {
"memory": 500
},
"options": {
"quality": 80
},
"png": {
"compressionLevel": 9
},
"webp": {
"reductionEffort": 6
},
"jpeg": {
"quality": 75
}
}