A small Ruby script for compressing SVGs that contain base64 encoded PNGs
Use bundler to install dependencies:
bundle install
The node SVGO tool is also a prerequisite:
npm install -g svgo
To run from anywhere, add the script to your shell:
export PATH=$PATH:/path/to/svg-compressor
To recursively convert SVGs in all subdirectories, run:
svg-compressor.rb <quality>
The jpeg compression quality can be set using quality
with an integer value of 1
-100
(1 being lowest quality and highest compression rate).
The SVG XML itself is then compressed and formatted using an SVGO wrapper.
Please feel free to open an issue for 🐛 or feature requests.