Includes various bug fixes for existing plugins and a new optimization. Also splits removeXMLNS, which removed XLink, into two separate plugins, removeXMLNS and removeXlink.
What's Changed
Default Behavior
- removeXMLNS, no longer removes the XLink (
xmlns:xlink) namespace. If that is desirable, you should enable the new removeXlink plugin, which does more while being safer. By @TrySound and @SethFalco in #1535
Bug Fixes
- convertPathData, ignore instances where transform applied via style tag. By @SethFalco in #1830
- inlineStyles, inline properties with the same specificity in the order that they appear in the stylesheet. By @SethFalco in #1831
- inlineStyles, don't remove class or id from node if it's traversed in another CSS selector. By @SethFalco in #1832 and #1836
- Don't trim
preelements inforeignObject. By @SethFalco in #1796 - Don't crash when encountering
@-webkit-keyframesin<style>node. By @SethFalco in #1826
SVG Optimization
- convertPathData, convert to
zcommand if going back to initial position, or dropzif redundant. By @KTibow in #1822 - inlineStyles, when inlining a CSS property that's already declared in a presentation attribute of the node, drop the attribute. By @SethFalco in #1829
- removeXlink, new plugin that removes the XLink (
xmlns:xlink) namespace and migrates from XLink attributes to the SVG 2 equivalent. Disabled by default. By @TrySound and @SethFalco in #1535
Metrics
Before and after using vectors from various sources, with the default preset of each respective version:
| SVG | Original | v3.0.3 | v3.0.4 | Delta |
|---|---|---|---|---|
| Arch Linux Logo | 9.529 KiB | 4.738 KiB | 4.735 KiB | ⬇️ 0.003 KiB |
| Blobs | 50.45 KiB | 42.949 KiB | 42.949 KiB | |
| Isometric Madness | 869.034 KiB | 550.699 KiB | 550.593 KiB | ⬇️ 0.106 KiB |
| tldr-pages Banner | 2.071 KiB | 1.07 KiB | 1.07 KiB | |
| Wikipedia Logo | 161.552 KiB | 118.441 KiB | 117.152 KiB | ⬇️ 1.289 KiB |
Before and after of the browser bundle of each respective version:
| v3.0.3 | v3.0.4 | Delta | |
|---|---|---|---|
| svgo.browser.js | 651.7 kB | 656.9 kB | ⬆️ 5.2 kB |