Includes various bug fixes and optimizations for existing plugins.
We're also revamped the documentation for the project. You can find it on svgo.dev!
The frontend for svgo.dev is maintained in svg/svgo.dev, contributions are welcome.
What's Changed
Settings
- Remove Comments, introduces
preservePatterns
parameter. Preserves legal comments by default, same as the previous behavior, but can now be overridden. By @SethFalco in #1812 - Remove Description, set the
removeAny
parameter tofalse
by default for accessibility. By @SethFalco in #1806
Bug Fixes
- Remove Raster Images, removes inlined JPEG images. By @abejfehr in #1742
- Cleanup IDs, correctly handle when 2 IDs have been referenced in a single attribute. By @SethFalco in #1795
- Cleanup IDS, correctly handle when we've encountered a reference to a node that doesn't exist. By @SethFalco in #1817
- Inline Styles, treat style prop keys as case-insensitive. By @SethFalco in #1797
- Inline Styles, remove all classes in multiclass selector. By @SethFalco in #1801
- Inline Styles, ignore empty CSS blocks instead of adding empty style attribute. By @SethFalco in #1823
- Minify Styles, removes unused class selectors when the document has no classes. By @SethFalco in #1800
- Prefix IDs, reuse the same prefix when encountering an ID multiple times. By @SethFalco in #1814
- Remove Hidden Elements, stops removing non-rendering elements like masks. By @SethFalco in #1793
- Reuse Paths, creates a new ID if the current one is referenced by another element. By @SethFalco in #1784
- Reuse Paths, removes redundant
defs
children after optimization. By @SethFalco in #1785 - Reuse Paths, stops duplicating attributes into the shared definition. By @SethFalco in #1791
- Don't crash on a
null
,undefined
, or empty plugin. Instead, log a warning and ignore it. By @SethFalco in #1128
SVG Optimization
- Convert Transform, omit spaces between functions. By @SethFalco in #1802
- Remove Scripts, removes callbacks (
on*
) andhref
attributes withjavascript:
URIs. By @cakeinpanic and @SethFalco in #1807, #1818, #1819, #1820 - Convert One-Stop Gradients, new plugin to convert gradients with one stop to a solid color, disabled by default. By @SethFalco in #1790
Performance
- Various optimizations for path handling. By @marvinhagemeister in #1716 and #1717
Chores
- Revise the README. By @ADTC in #1731
- Fix dead link to postcss-svgo in README. By @Lehoczky in #1770
- Replace webpack loader library in README as previous was deprecated. By @tanyabouman in #1771
Metrics
Before and after using vectors from various sources, with the default preset of each respective version:
SVG | Original | v3.0.2 | v3.0.3 | Delta |
---|---|---|---|---|
Arch Linux Logo | 8.584 KiB | 4.748 KiB | 4.747 KiB | ⬇️ 0.001 KiB |
Blobs | 50.45 KiB | 42.949 KiB | 42.949 KiB | |
Isometric Madness | 869.034 KiB | 550.829 KiB | 550.699 KiB | ⬇️ 0.13 KiB |
tldr-pages Banner | 2.071 KiB | 1.07 KiB | 1.07 KiB | |
Wikipedia Logo | 161.552 KiB | 118.441 KiB | 118.441 KiB |
Before and after of the browser bundle of each respective version:
v3.0.2 | v3.0.3 | Delta | |
---|---|---|---|
svgo.browser.js | 643.5 kB | 651.7 kB | ⬆️ 8.2 kB |