v3.0.3
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
Default Behavior
- removeComments, introduces
preservePatterns
parameter. Preserves legal comments by default, same as the previous behavior, but can now be overridden. By @SethFalco in #1812 - removeDesc, set the
removeAny
parameter tofalse
by default for accessibility. By @SethFalco in #1806
Bug Fixes
- removeRasterImages, removes inline JPEG images. By @abejfehr in #1742
- cleanupIds, correctly handle when 2 IDs have been referenced in a single attribute. By @SethFalco in #1795
- cleanupIds, correctly handle when we've encountered a reference to a node that doesn't exist. By @SethFalco in #1817
- inlineStyles, treat style prop keys as case-insensitive. By @SethFalco in #1797
- inlineStyles, remove all classes in multiclass selector. By @SethFalco in #1801
- inlineStyles, ignore empty CSS blocks instead of adding empty style attribute. By @SethFalco in #1823
- minifyStyles, removes unused class selectors when the document has no classes. By @SethFalco in #1800
- prefixIds, reuse the same prefix when encountering an ID multiple times. By @SethFalco in #1814
- removeHiddenElems, stops removing non-rendering elements like masks. By @SethFalco in #1793
- reusePaths, creates a new ID if the current one is referenced by another element. By @SethFalco in #1784
- reusePaths, removes redundant
defs
children after optimization. By @SethFalco in #1785 - reusePaths, 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
- convertTransform, omit spaces between functions. By @SethFalco in #1802
- removeScriptElement, removes callbacks (
on*
) andhref
attributes withjavascript:
URIs. By @cakeinpanic and @SethFalco in #1807, #1818, #1819, #1820 - convertOneStopGradients, 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 |