svgo_cli 1.0.0
svgo_cli: ^1.0.0 copied to clipboard
Command-line interface for SVGO - a tool for optimizing SVG files. Port of the popular Node.js SVGO optimizer.
SVGO CLI
π¨π³ δΈζ
Command-line interface for SVGO - the SVG optimizer.
Installation #
dart pub global activate svgo_cli
Usage #
# Optimize a single file (overwrites input)
svgo input.svg
# Optimize to output directory
svgo -o dist input.svg
# Optimize multiple files
svgo icon1.svg icon2.svg icon3.svg
# Optimize all SVGs in a directory (using glob pattern)
svgo "src/**/*.svg"
# Multipass optimization
svgo -m input.svg
# Custom precision (2 decimal places)
svgo -p 2 input.svg
# Quiet mode (no output messages)
svgo -q input.svg
# Show help
svgo --help
# Show version
svgo --version
Options #
| Option | Short | Description |
|---|---|---|
--help |
-h |
Show help message |
--version |
-v |
Show version information |
--output <DIR> |
-o |
Output directory (default: overwrite input) |
--quiet |
-q |
Suppress output messages |
--recursive |
-r |
Process directories recursively |
--precision <NUM> |
-p |
Float precision (default: 3) |
--multipass |
-m |
Run optimizations multiple times |
Examples #
Optimize a single file #
svgo logo.svg
Output:
logo.svg β logo.svg (1234 β 789 bytes, 36.1% saved)
Processed 1 file(s), saved 445 bytes total.
Batch processing #
svgo -o optimized "assets/**/*.svg"
CI/CD Usage #
# Quiet mode for scripts
svgo -q -o dist *.svg
Configuration #
The CLI uses the default preset (preset-default) with safe optimizations. Future versions will support configuration files for custom plugin settings.
Exit Codes #
| Code | Description |
|---|---|
| 0 | Success |
| 1 | Error (file not found, parse error, etc.) |
License #
MIT License - Copyright (c) 2025 iota9star