@becklyn/svg-min
v0.0.2
Published
svg-min =======
Downloads
3
Maintainers
Keywords
Readme
svg-min
Minifies SVGs.
This small lib combines the following features:
- Applies transforms, so that the transforms are automatically absorbed into the paths.
- Removes unnecessary attributes.
- Moves the complete SVG, so that the origin is at
0 0
. - Crops the artboard to only contain the actual object and no whitespace around it.
- Runs
SVGO
.
Installation
npm -g i @becklyn/svg-min
Usage
# will overwrite the original file
svg-min test.svg
# will create the minified file in test.min.svg
svg-min test.svg --keep
# will create the minified file in out.svg
svg-min test.svg out.svg
# globs are also supported
svg-min *.svg
# if your shell automatically replaces globs use
svg-min "*.svg"
Caveats
The implementation is pretty rudimentary and a lot of SVG features are not supported:
- The script will bail if any
transform
excepttranslate
is used. - The cropping of the artboard might fail.