svgo
4.1.0 · 24 Aug 2026MIT52.3M / weekRepositoryHomepagenpmAtom feed
107 stable releases, newest first, by release line. Notes are quoted as the maintainers published them.
- 4.x · latest line
4.1.0
24 Aug 2026- Security
Filters executable
data:URLs containing HTML, XHTML, or SVG documents while preserving inert data such as PNG images, and filters legacyvbscript:URLs (#2263). - Security
Sanitizes content inside SVG
<foreignObject>elements by removing HTML event-handler attributes,srcdoc, and executable URLs fromaction,data,formaction,href, andsrc, while preserving non-executable HTML and visual content (#2264). - Security
Recognizes namespace-prefixed SVG
<a>elements and removes ASCII tabs and newlines before checking URL schemes, preventing values such asjava	script:from bypassing detection while preserving elements in unrelated custom namespaces (#2268).
This minor release upgrades the SAX parser and introduces stricter XML validation. It also includes important security hardening for
removeScripts, dependency updates, and improvements to the test and regression infrastructure.Support SVGO
If SVGO is valuable to you or your organization, please consider supporting the project on OpenCollective. Your sponsorship helps fund ongoing maintenance and security work.
Stricter XML validation
SVGO now uses
sax1.6.1, upgraded from 1.5.0 (#2257).The new parser version validates numeric character references against the ranges permitted by XML. Invalid references are now rejected in both text and attributes, including:
Disallowed control characters such as
,, and;UTF-16 surrogate code points such as
�;Invalid XML code points such as
.
Valid boundary values—including
U+0020,U+D7FF,U+E000,U+FFFD, and characters throughU+10FFFF—remain supported.Parser failures are consistently exposed as
SvgoParserErrorerrors with anInvalid character entityreason.This is an intentional behavior change: malformed SVGs that were previously accepted may now produce a parser error, while valid XML documents are unaffected.
Security
The
removeScriptsplugin has been hardened against several script-execution bypasses:- Security
Filters executable
data:URLs containing HTML, XHTML, or SVG documents while preserving inert data such as PNG images, and filters legacyvbscript:URLs (#2263). - Security
Sanitizes content inside SVG
<foreignObject>elements by removing HTML event-handler attributes,srcdoc, and executable URLs fromaction,data,formaction,href, andsrc, while preserving non-executable HTML and visual content (#2264). - Security
Recognizes namespace-prefixed SVG
<a>elements and removes ASCII tabs and newlines before checking URL schemes, preventing values such asjava	script:from bypassing detection while preserving elements in unrelated custom namespaces (#2268).
These changes address:
- Security
- Security
Project maintenance
@TrySound is back as an active SVGO maintainer.
Many thanks to @KTibow, @SethFalco, and @XhmikosR for maintaining and improving SVGO over the past several years.
4.0.2
11 Jul 2026- Security
removeScripts, remove JavaScript URIs case-insensitively and make
<script>handling namespace aware. convertColors, skip case-normalization for CSS custom properties.
convertPathData, improve handling of consecutive
tcommands.
What's Changed
Security
- Security
removeScripts, remove JavaScript URIs case-insensitively and make
<script>handling namespace aware.
Bug Fixes
convertColors, skip case-normalization for CSS custom properties.
convertPathData, improve handling of consecutive
tcommands.convertPathData, safer handling of paths.
Improve parsing of negative (or +) arc radii.
When converting to a data URI, only encode it as a data URI once.
Performance
mergePaths, speed up child node removal.
Other Changes
removeAttributesBySelector, log warning and noop if missing parameters.
4.0.1
4 Mar 2026removeEmptyContainers, removed leftover
<use>elements referencing an empty container that were removed.removeUnknownsAndDefaults, don't remove attributes if they're referenced in attribute selectors (CSS).
convertPathData, refactor to reduce redundant equality checks.
What's Changed
Bug Fixes
removeEmptyContainers, removed leftover
<use>elements referencing an empty container that were removed.removeUnknownsAndDefaults, don't remove attributes if they're referenced in attribute selectors (CSS).
Performance
convertPathData, refactor to reduce redundant equality checks.
removeHiddenElems, compute styles lazily.
Other Changes
Plugins no longer include if they are enabled or disabled by default, as this was written inconsistently. The
--show-pluginsargument appends the presets a plugin is in to the end of the line.Plugin/preset types to enforce the name start with
preset-if it is a preset (collection of plugins).
Metrics
Before and after of the browser bundle of each respective version:
v4.0.0 v4.0.1 Delta svgo.browser.js 780.2 kB 781.5 kB ⬆️ 1.3 kB 4.0.0
21 Jun 2025- Breaking
removeViewBox removes the scalability of SVGs.
- Breaking
removeTitle reduces accessibility, which preserving accessibility is more important than optimization.
- Breaking
svgo— for normal usage, such as scripts or server-side applications.
Banner celebrating the release of SVGO v4.0.0. Includes the SVGO mascot drawing on a chalkboard with the changes in default plugins. For example, removeViewBox was moved from default plugins to available plugins.
Illustration by Vukory
It's been just over a year since our first release candidate, but I believe we can now release SVGO v4.0.0 with confidence! Thank you to all contributors who tested our RC builds and reported issues back up, this really smoothed out the process.
We actually wanted to do the release sooner, but it was a challenge to find the right time to publish a major release, since that means setting time aside to support users through migrations, helping downstream projects migrate, being available to fix or document things that users found to have an unexpected impact by this release, etc. I appreciate everyone's patience, and now that this is done, we can hopefully increase the pace of development again and tackle that backlog of old bugs. ^-^'
Breaking Changes
Please refer to the Migration Guide from v3 to v4 for a more concise version! This section is more verbose as it delves into the motivation of changes too.
Dropped Support for Node.js v14
Node.js v14 is no longer supported by the Node.js team, including security support, since 30 April 2023. Node.js v16 is no longer supported either, but as some are still using it, we'll save dropping support for Node.js v16 for the next major release.
This allows us to update our dependencies to more recent versions and to access more modern Node.js APIs.
Node.js v14 may still work at the time of this release, but we'll no longer be testing against v14 from now on.
Default Plugins
Both removeViewBox and removeTitle have been disabled by default. Both have been major pain points for users and don't make sense to enable in most cases. Other libraries wrapping SVGO have also been disabling these plugins by default, such as Docusaurus and SVGR.
- Breaking
removeViewBox removes the scalability of SVGs.
- Breaking
removeTitle reduces accessibility, which preserving accessibility is more important than optimization.
If you would like either of these plugins enabled, you can do so by configuring it in the SVGO config, see the README for more context, however please read the warnings described in the documentation of the plugins first:
export default { plugins: [ 'preset-default', // built-in plugins enabled by default + 'removeViewBox', + 'removeTitle', ], };removeScriptElement → removeScripts
The removeScriptElement plugin has been renamed to removeScripts, to more accurately reflect what the plugin does. It does not only remove the
<script>tag, but also event handlers and script URIs from links.To migrate, amend your SVGO config to refer to
removeScriptsinstead if you use that plugin.export default { plugins: [ 'preset-default', // built-in plugins enabled by default - 'removeScriptElement', + 'removeScripts', ], };Imports/Exports
We now enforce boundaries between the intended public API and any internal structures/helpers. This is the biggest change in SVGO's JavaScript API and will enable maintainers and users to have a mutual understanding of what is public API and what isn't.
There are two ways to import SVGO:
- Breaking
svgo— for normal usage, such as scripts or server-side applications. - Breaking
svgo/browser— for browser usage.
If you use the browser bundle, you must amend how you import SVGO:
- import { optimize } from 'svgo/dist/svgo.browser.js'; + import { optimize } from 'svgo/browser';For ESM/browser, you must use named imports:
// ESM and Browser, named exports import { VERSION } from 'svgo'; console.log(VERSION); // 4.0.0-rc.0 // ESM and Browser, import all import * as svgo from 'svgo/browser'; console.log(svgo.VERSION); // 4.0.0-rc.0 // Common JS, default export const svgo = require('svgo'); console.log(svgo.VERSION); // 4.0.0-rc.0 // CommonJS, named exports const { VERSION } = require('svgo'); console.log(VERSION); // 4.0.0-rc.0We support 3 environments, ESM, Common JS, and browser. The only functional difference is that the
loadConfigfunction is not exported in the browser bundle.If you depended on a helper that we haven't declared as public, then you are encouraged to implement it yourself, or dig into our source and copy it over to your project.
Importing Plugins
If you import/require the array of built-in plugins, or a single plugin during runtime, this is now a top-level export instead:
// builtin.mjs - get an array of all built-in plugins - import { builtin } from 'svgo/lib/builtin'; + import { builtinPlugins } from 'svgo' // plugin.mjs - get a single plugin - import presetDefault from 'svgo/plugins/preset-default'; + import { builtinPlugins } from 'svgo'; + const presetDefault = builtinPlugins.find(plugin => plugin.name === 'preset-default'); // plugin-map.mjs - get all plugins as a map using the plugin name as a key import { builtinPlugins } from 'svgo'; const pluginMap = builtinPlugins.reduce((acc, val) => acc.set(val.name, val), new Map());Selector Helpers
The
XastNode#parentNodeproperty was declared legacy and pending removal for v4, but was still used internally. The remaining instances have now been removed, which required a refactor of the selector helpers.This effects custom plugins that use any of the following functions, where the
selector(2nd) argument could reference parent or sibling nodes (i.e.div > span):- Breaking
querySelectorAll - Breaking
querySelector - Breaking
matches
Previously, these functions had the context of the whole node tree, even if a child node was passed to it. It no longer has that context by default. The new API for these functions is as follows:
// applies `selector` with the context of the `childNode` and its descendants const nodes = querySelectorAll(childNode, selector); // applies `selector` with the context of the entire node tree relative from `childNode` // the `rootNode` is required if the result of `selector` may depend on the parent or sibling of `childNode` const nodes = querySelectorAll(childNode, selector, rootNode); // this usage has the same behavior as v3, as `rootNode` is already the entire node tree const nodes = querySelectorAll(rootNode, selector);
A helper has been provided named
#mapNodesToParents, which does this for you. This can be used to easily migrate to the new API. If you're not sure if you need it, then it's safer to take this approach. The third argument won't be necessary ifselectordoes not traverse nodes, for example, querying using one or more attributes of a single node.- import { querySelectorAll } from 'svgo'; + import { querySelectorAll, mapNodesToParents } from 'svgo'; - const nodes = querySelectorAll(childNode, selector); + const nodes = querySelectorAll(childNode, selector, mapNodesToParents(rootNode));What Else
ESM
SVGO is now a dual package, serving for both Common JS and ESM usage. To be more explicit, SVGO will continue to work on Common JS projects!
Default Behavior
convertColors, now converts all references to colors excluding references to IDs to lowercase. This can be disabled by setting
convertCasetofalse.
Bug Fixes
cleanupIds, treat both URI encoded and non-URI encoded IDs as the same.
collapseGroups, check styles as well as attributes.
collapseGroups, move attributes atomically.
convertPathData, fix q control point when item is removed.
convertPathData, preserve vertex for markers only paths.
mergePaths, don't merge paths if attributes/styles depend on the node's bounding box.
moveElemsAttrsToGroups, no longer moves the transforms if group has the
filterattribute.prefixIds, fixed issue where some IDs were not prefixed when style tag contained XML comments.
removeEmptyContainers, fixed an issue where we removed empty containers with filters applied via CSS, when it should be skipped.
removeHiddenElems, don't remove node if child element has a referenced ID.
removeHiddenElems, treat
path[opacity=0]as a non-rendering node.removeUselessDefs, don't remove node if child element has an ID.
When stringifying path data, include a space before numbers represented in scientific notation.
No longer crashes when the output (
-oargument) ends with a trailing slash to a location that didn't exist.
Features
Add
VERSIONexport so get the version of SVGO during runtime.Introduce an
isPresetandpluginsproperty to plugins, which are only defined for presets. This will indicate if the plugin is a preset, and return the plugins that are in the preset in the order they are invoked.
SVG Optimization
convertColors, introduce parameter to convert colors to common casing (lowercase/uppercase).
- Deprecated
removeDeprecatedAttrs, new plugin that is disabled by default to remove SVG attributes that are deprecated.
removeEditorsNSData, include Boxy SVG namespace in the list of editor namespaces to remove.
removeEditorsNSData, include Krita namespace in the list of editor namespaces to remove.
Performance
Use string methods instead of a regular expression when parsing SVGs.
Developer Experience
We now generate our type declarations from JSDoc comments instead of maintaining them manually. Types will be much more accurate, include more documentation, and are guaranteed to be in sync with the implementation.
Metrics
Before and after using vectors from various sources, with the default preset of each respective version:
SVG Original v3.3.2 v4.0.0 Delta Arch Linux Logo 9.529 KiB 4.115 KiB 4.097 KiB ⬇️ 0.018 KiB Blobs 50.45 KiB 42.623 KiB 42.633 KiB ⬆️ 0.01 KiB Isometric Madness 869.034 KiB 540.582 KiB 540.141 KiB ⬇️ 0.441 KiB tldr-pages Banner 2.071 KiB 1.07 KiB 1.07 KiB Wikipedia Logo 161.551 KiB 111.668 KiB 111.727 KiB ⬆️ 0.059 KiB Note: The increase in size from previous versions is from disabling
removeViewBoxandremoveTitle, with the benefit of preserving scalability and accessibility.Before and after of the browser bundle of each respective version:
v3.3.2 v4.0.0 Delta svgo.browser.js 753.0 kB 780.2 kB ⬆️ 27.2 kB - 3.x
3.3.5
24 Aug 2026- Security
Backport the
removeScriptElementhardening from SVGO v4 in #2269:
What's Changed
Security
- Security
Backport the
removeScriptElementhardening from SVGO v4 in #2269:reject executable
data:URLs and legacyvbscript:URLssanitize executable HTML inside
<foreignObject>elementshandle namespace-prefixed SVG anchors and URL schemes containing ASCII tabs or newlines
This addresses GHSA-4vpr-x523-8j87 and GHSA-w27v-7q3p-w38r for the v3 release line.
Support
SVGO v3 is not officially supported; please consider upgrading to SVGO v4. This security fix has been backported, but there is no commitment to backport more complex changes in the future.
See the migration guide from v3 to v4.
3.3.4
11 Jul 2026- Security
removeScriptElement, remove JavaScript URIs case-insensitively and make
<script>handling namespace aware.
What's Changed
Security
- Security
removeScriptElement, remove JavaScript URIs case-insensitively and make
<script>handling namespace aware.
Support
SVGO v3 is not officially supported, please consider upgrading to SVGO v4 instead. We've backported this fix as there are security implications, but there is no commitment to do this for more complex changes in future.
Consider reading our Migration Guide from v3 to v4 which should ease the process.
3.3.3
4 Mar 2026No longer throws error when encountering comments in DTD.
What's Changed
Bug Fixes
No longer throws error when encountering comments in DTD.
Metrics
Before and after of the browser bundle of each respective version:
v3.3.2 v3.3.3 Delta svgo.browser.js 910.9 kB 912.9 kB ⬆️ 2 kB Support
SVGO v3 is not officially supported, please consider upgrading to SVGO v4 instead. We've backported this fix as there are security implications, but there is no commitment to do this for more complex changes in future.
Consider reading our Migration Guide from v3 to v4 which should ease the process.
3.3.2
9 May 2024An update on what happened with v3.3.0 and v3.3.1. While we have retained CJS support, the migration to ESM has changed the acceptable ways to import SVGO, in ways that users depended on before. This effectively made SVGO v3 a breaking change.
Notice
An update on what happened with v3.3.0 and v3.3.1. While we have retained CJS support, the migration to ESM has changed the acceptable ways to import SVGO, in ways that users depended on before. This effectively made SVGO v3 a breaking change.
Rather than resolve or workaround these differences, we've opted to release SVGO v3.3.2, which is effectively a revert to v3.2.0, and deprecate versions v3.3.0 and v3.3.1. We'll then proceed to work on releasing v4 which will document the breaking changes, and feature further breaking changes that were slated for v4, like disabling
removeViewBoxby default.Before the v4.0.0 release, I'll put more focus on testing and use release candidates, just to make the release go smoothly! 👍🏽
Sorry for the headache, and thank you for your patience.
3.3.1
8 May 2024SVGO v3.3.0, which was meant to migrate to ESM without breaking CJS support, unfortunately broke CJS projects. There was a mistake with exports, so the
loadConfigfunction wasn't available in the CJS bundle and lead to issues for many users.Notice
SVGO v3.3.0, which was meant to migrate to ESM without breaking CJS support, unfortunately broke CJS projects. There was a mistake with exports, so the
loadConfigfunction wasn't available in the CJS bundle and lead to issues for many users.I apologize for letting that breaking change through, and will aim to do better. Namely, by adding more tests to cover our exports, and any other public interface in general for each distribution of SVGO, so this doesn't happen again.
SVGO v3.3.1 should resolve the issue for CJS projects, but if you encounter anything else, do let us know by opening an issue on GitHub.
3.3.0
8 May 2024- Deprecated
removeDeprecatedAttrs, new plugin that is disabled by default to remove SVG attributes that are deprecated.
convertColors, now converts all references to colors excluding references to IDs to lowercase. This can be disabled by setting
convertCasetofalse.cleanupIds, treat both URI encoded and non-URI encoded IDs as the same.
Deprecated
This release introduced breaking changes, which have been reverted in v3.3.2. The bug fixes will be reintroduced in v4.0.0.
What's Changed
ESM
SVGO is now a dual package, serving for both Common JS and ESM usage. We believe there shouldn't be any problems, especially as SVGO as largely stateless, but feel free to open an issue if you encounter problems with this.
To be explicit, this is not a breaking change, and SVGO should continue to work in Common JS projects!
Default Behavior
convertColors, now converts all references to colors excluding references to IDs to lowercase. This can be disabled by setting
convertCasetofalse.
Bug Fixes
cleanupIds, treat both URI encoded and non-URI encoded IDs as the same.
collapseGroups, check styles as well as attributes.
collapseGroups, move attributes atomically.
convertPathData, fix q control point when item is removed.
convertPathData, preserve vertex for markers only paths.
mergePaths, don't merge paths if attributes/styles depend on the node's bounding box.
moveElemsAttrsToGroups, no longer moves the transforms if group has the
filterattribute.prefixIds, fixed issue where some IDs were not prefixed when style tag contained XML comments.
removeHiddenElems, don't remove node if child element has a referenced ID.
removeHiddenElems, treat
path[opacity=0]as a non-rendering node.removeUselessDefs, don't remove node if child element has an ID.
When stringifying path data, include a space before numbers represented in scientific notation.
No longer crashes when the output (
-oargument) ends with a trailing slash to a location that didn't exist.
SVG Optimization
convertColors, introduce parameter to convert colors to common casing (lowercase/uppercase).
- Deprecated
removeDeprecatedAttrs, new plugin that is disabled by default to remove SVG attributes that are deprecated.
Metrics
Before and after using vectors from various sources, with the default preset of each respective version:
SVG Original v3.2.0 v3.3.0 Delta Arch Linux Logo 9.529 KiB 4.115 KiB 4.097 KiB ⬇️ 0.018 KiB Blobs 50.45 KiB 42.623 KiB 42.609 KiB ⬇️ 0.014 KiB Isometric Madness 869.034 KiB 540.582 KiB 540.073 KiB ⬇️ 0.509 KiB tldr-pages Banner 2.071 KiB 1.07 KiB 1.07 KiB Wikipedia Logo 161.551 KiB 111.668 KiB 111.668 KiB Before and after of the browser bundle of each respective version:
v3.2.0 v3.3.0 Delta svgo.browser.js 910.9 kB 753.0 kB ⬇️ 157.9 kB 3.2.0
2 Jan 2024convertPathData, fix instances were
qwas incorrectly converted tot.convertTransform, fix for some transforms that weren't being converted correctly.
convertPathData, improves closing paths and how we determine if to use absolute or relative commands.
What's Changed
Bug Fixes
convertPathData, fix instances were
qwas incorrectly converted tot.convertTransform, fix for some transforms that weren't being converted correctly.
SVG Optimization
convertPathData, improves closing paths and how we determine if to use absolute or relative commands.
convertPathData, round arc or convert to lines based on the sagitta, can be disabled by setting
smartArcRoundingtofalse.convertPathData, convert cubic Bézier curves to quadratic Bézier curves where possible, can be disabled by setting
convertToQtofalse.
Performance
mergePaths, refactor for performance with large files.
convertPathData, refactor
#stringifyPathDatafor performance.
Metrics
Before and after using vectors from various sources, with the default preset of each respective version:
SVG Original v3.1.0 v3.2.0 Delta Arch Linux Logo 9.529 KiB 4.162 KiB 4.115 KiB ⬇️ 0.047 KiB Blobs 50.45 KiB 42.949 KiB 42.623 KiB ⬇️ 0.326 KiB Isometric Madness 869.034 KiB 550.153 KiB 540.582 KiB ⬇️ 9.571 KiB tldr-pages Banner 2.071 KiB 1.07 KiB 1.07 KiB Wikipedia Logo 161.551 KiB 116 KiB 111.668 KiB ⬇️ 4.332 KiB Before and after of the browser bundle of each respective version:
v3.1.0 v3.2.0 Delta svgo.browser.js 660.9 kB 910.9 kB ⬆️ 250 kB 3.1.0
11 Dec 2023prefixIds, correctly prefix IDs when
<style>tag contains XML comments.removeHiddenElems, improve handling of definitions (
<defs>), namely when<defs>are defined at the end of the document.cleanupEnableBackground, clean up inline-styles too.
What's Changed
Bug Fixes
prefixIds, correctly prefix IDs when
<style>tag contains XML comments.removeHiddenElems, improve handling of definitions (
<defs>), namely when<defs>are defined at the end of the document.cleanupEnableBackground, clean up inline-styles too.
cleanupIds, handle URI encoded references properly.
inlineStyles, no longer crashes on non-inlined selectors with a pseudo-class.
Improve handling of URL references in reference attributes (
url('#a')) across various plugins.
SVG Optimization
removeUnknownsAndDefaults, now removes defaults in XML declarations too, enabled by default and can be toggled with
defaultMarkupDeclarations.
Metrics
Before and after using vectors from various sources, with the default preset of each respective version:
SVG Original v3.0.5 v3.1.0 Delta Arch Linux Logo 9.529 KiB 4.608 KiB 4.162 KiB ⬇️ 0.446 KiB Blobs 50.45 KiB 42.949 KiB 42.949 KiB Isometric Madness 869.034 KiB 550.153 KiB 550.153 KiB tldr-pages Banner 2.071 KiB 1.07 KiB 1.07 KiB Wikipedia Logo 161.551 KiB 117.146 KiB 116 KiB ⬇️ 1.146 KiB Before and after of the browser bundle of each respective version:
v3.0.5 v3.1.0 Delta svgo.browser.js 657.5 kB 660.9 kB ⬆️ 3.4 kB 3.0.5
30 Nov 2023cleanupIds, correctly handle references to other nodes in animations.
convertPathData, fix issue when removing redundant
Zbetween mergableM/mcommands.convertPathData, adhere to error/precision in
zconversions.
What's Changed
Bug Fixes
cleanupIds, correctly handle references to other nodes in animations.
convertPathData, fix issue when removing redundant
Zbetween mergableM/mcommands.convertPathData, adhere to error/precision in
zconversions.removeEmptyContainers, skip if parent node is
<switch>, as empty containers can be used for attributes likerequiredFeatures.removeHiddenElems, when removing a hidden definition, also remove nodes that reference it.
Output the optimization stats (profit) in red if the file size increased.
Type definition files now correctly use the
.d.tsfile extension instead of.ts.
Metrics
Before and after using vectors from various sources, with the default preset of each respective version:
SVG Original v3.0.4 v3.0.5 Delta Arch Linux Logo 9.529 KiB 4.735 KiB 4.608 KiB ⬇️ 0.127 KiB Blobs 50.45 KiB 42.949 KiB 42.949 KiB Isometric Madness 869.034 KiB 550.593 KiB 550.153 KiB ⬇️ 0.44 KiB tldr-pages Banner 2.071 KiB 1.07 KiB 1.07 KiB Wikipedia Logo 161.551 KiB 117.152 KiB 117.146 KiB ⬇️ 0.006 KiB Before and after of the browser bundle of each respective version:
v3.0.4 v3.0.5 Delta svgo.browser.js 656.9 kB 657.5 kB ⬆️ 0.6 kB 3.0.4
18 Nov 2023removeXMLNS, 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.convertPathData, ignore instances where transform applied via style tag.
inlineStyles, inline properties with the same specificity in the order that they appear in the stylesheet.
Includes various bug fixes for existing plugins and a new optimization. Also splits
removeXMLNS, which removed XLink, into two separate plugins,removeXMLNSandremoveXlink.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.
Bug Fixes
convertPathData, ignore instances where transform applied via style tag.
inlineStyles, inline properties with the same specificity in the order that they appear in the stylesheet.
inlineStyles, don't remove class or id from node if it's traversed in another CSS selector.
Don't trim
preelements inforeignObject.Don't crash when encountering
@-webkit-keyframesin<style>node.
SVG Optimization
convertPathData, convert to
zcommand if going back to initial position, or dropzif redundant.inlineStyles, when inlining a CSS property that's already declared in a presentation attribute of the node, drop the attribute.
removeXlink, new plugin that removes the XLink (
xmlns:xlink) namespace and migrates from XLink attributes to the SVG 2 equivalent. Disabled by default.
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 3.0.3
8 Nov 2023removeComments, introduces
preservePatternsparameter. Preserves legal comments by default, same as the previous behavior, but can now be overridden.removeDesc, set the
removeAnyparameter tofalseby default for accessibility.removeRasterImages, removes inline JPEG images.
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
preservePatternsparameter. Preserves legal comments by default, same as the previous behavior, but can now be overridden.removeDesc, set the
removeAnyparameter tofalseby default for accessibility.
Bug Fixes
removeRasterImages, removes inline JPEG images.
cleanupIds, correctly handle when 2 IDs have been referenced in a single attribute.
cleanupIds, correctly handle when we've encountered a reference to a node that doesn't exist.
inlineStyles, treat style prop keys as case-insensitive.
inlineStyles, remove all classes in multiclass selector.
inlineStyles, ignore empty CSS blocks instead of adding empty style attribute.
minifyStyles, removes unused class selectors when the document has no classes.
prefixIds, reuse the same prefix when encountering an ID multiple times.
removeHiddenElems, stops removing non-rendering elements like masks.
reusePaths, creates a new ID if the current one is referenced by another element.
reusePaths, removes redundant
defschildren after optimization.reusePaths, stops duplicating attributes into the shared definition.
Don't crash on a
null,undefined, or empty plugin. Instead, log a warning and ignore it.
SVG Optimization
convertTransform, omit spaces between functions.
removeScriptElement, removes callbacks (
on*) andhrefattributes withjavascript:URIs.convertOneStopGradients, new plugin to convert gradients with one stop to a solid color, disabled by default.
Performance
Various optimizations for path handling.
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 3.0.2
18 Nov 2022Installing
@types/cssono longer required3.0.1
11 Nov 2022Store exposed types only in .d.ts files, no longer need to enable js checking
Update svgo.browser.js
Fixed "begin" attribute cleanup
3.0.0
23 Oct 2022- Breaking
Node.js 14+ is required for version
- Breaking
Stable package is replaced with native stable sort (required node 12+)
Fixed
dataurioption whenmultipassis not enabled
SVGO v3
Improvements and fixes
Fixed
dataurioption whenmultipassis not enabledImproved default preset warnings
Breaking Changes
Please refer to the Migration Guide from v2 to v3 for a more concise version!
- Breaking
Node.js 14+ is required for version
- Breaking
Stable package is replaced with native stable sort (required node 12+)
Config
Typescript types are exposed out of the box. No longer need to install
@types/svgo// svgo.config.js /** * @type {import('svgo').Config} */ export default { // svgo configuration }Active flag is no longer supported
export default { plugins: [ { name: 'removeDoctype', active: true }, { name: 'removeComments', active: false } ] }extendDefaultPluginsis removed,preset-defaultplugin should be used instead
when need to customize plugins defaultsexport default { plugins: [ { name: 'preset-default', params: { overrides: { // plugins customization } } } ] }Enabled sortAttrs plugin by default to get better gzip compression.
<svg> - <rect fill-opacity="" stroke="" fill="" stroke-opacity="" /> + <rect fill="" fill-opacity="" stroke="" stroke-opacity="" /> </svg>
Can be disabled if necessary
export default { plugins: [ { name: 'preset-default', params: { overrides: { sortAttrs: false } } } ] }cleanupIDs plugin is renamed to cleanupIds
export default { plugins: [ 'cleanupIds' ] } // or export default { plugins: [ { name: 'preset-default', params: { overrides: { cleanupIds: {} } } } ] }Removed cleanupIds plugin "prefix" param, prefixIds should be used instead
export default { plugins: [ 'cleanupIds', { name: 'prefixIds', params: { prefix: 'my-prefix' } } ] }Public API
Removed width and height from optimization result.
const { width, height } = optimize(svg).infoCan be found with custom plugin
let width = null let height = null const plugin = { name: 'find-size', fn: () => { return { element: { enter: (node, parentNode) => { if (parentNode.type === 'root') { width = node.attributes.width height = node.attributes.height } } } } } } optimize(svg, { plugins: ['preset-default', plugin] })Removed error and modernError from optimization result
const {data, error, modernError } = optimize(svg)Now all errors are thrown, parsing error can be checked by name
try { const { data } = optimize(svg) } catch (error) { if (error.name === 'SvgoParserError') { // formatted error error.toString() } else { // runtime error } }Custom plugins
Removed
full,perItemandperItemReverseplugin types.visitoris the only supported plugin API soplugin.typeis no longer required.Removed
plugin.activeflag.Removed
plugin.paramsused as default params, destructuring with defaults can be used insteadnameandfnare only required nowconst plugin = { name: 'my-custom-plugin', fn: (root, params) => { const { myParam = true } = params return {} } }Removed
createContentItemand JSAPI class from nodes.
All nodes are now plain objects with one exception.
parentNode need to be defined to not break builtin plugins.const plugin = { name: 'my-custom-plugin', fn: () => { return { element: { enter: (node) => { if (node === 'g') { const child = { type: 'element', name: 'g', attributes: {}, children: [] } Object.defineProperty(child, 'parentNode', { writable: true, value: node, }) node.children.push(child) } } } } } }- 2.x
2.8.4
24 Aug 2026- Security
Backport the
removeScriptElementhardening from SVGO v4 in #2272:
What's Changed
Security
- Security
Backport the
removeScriptElementhardening from SVGO v4 in #2272:remove known SVG event attributes
reject executable
data:URLs and legacyvbscript:URLssanitize executable HTML inside
<foreignObject>elementshandle namespace-prefixed SVG anchors and URL schemes containing ASCII tabs or newlines
This addresses GHSA-4vpr-x523-8j87 and GHSA-w27v-7q3p-w38r for the v2 release line.
Support
SVGO v2 is not officially supported; please consider upgrading to SVGO v4. This security fix has been backported, but there is no commitment to backport more complex changes in the future.
2.8.3
11 Jul 2026- Security
removeScriptElement, make
<script>handling namespace aware.
What's Changed
Security
- Security
removeScriptElement, make
<script>handling namespace aware.
Support
SVGO v2 is not officially supported, please consider upgrading to SVGO v4 instead. We've backported this fix as there are security implications, but there is no commitment to do this for more complex changes in future.
Consider reading our Migration Guide from v2 to v3 and Migration Guide from v3 to v4 which should ease the process.
2.8.2
4 Mar 2026No longer throws error when encountering comments in DTD.
This is effectively just a re-release of SVGO v2.8.1, but with
*.test.jsfiles omitted. It seems something was wrong with the configuration in the v2.8.0 tag and I hadn't noticed it included a few extra files. :sweat_smile:We'll deprecate v2.8.1, and I'll include the change log here.
What's Changed
Bug Fixes
No longer throws error when encountering comments in DTD.
Metrics
Before and after of the browser bundle of each respective version:
v2.8.0 v2.8.2 Delta svgo.browser.js 587.2 kB 589.2 kB ⬆️ 2 kB Support
SVGO v2 is not officially supported, please consider upgrading to SVGO v4 instead. We've backported this fix as there are security implications, but there is no commitment to do this for more complex changes in future.
Consider reading our Migration Guide from v2 to v3 and Migration Guide from v3 to v4 which should ease the process.
2.8.1
4 Mar 2026No longer throws error when encountering comments in DTD.
Deprecated
This release left
*.test.jsfiles in the package, which have been omitted in v2.8.2. Sorry for the noise!What's Changed
Bug Fixes
No longer throws error when encountering comments in DTD.
Metrics
Before and after of the browser bundle of each respective version:
v2.8.0 v2.8.1 Delta svgo.browser.js 587.2 kB 589.2 kB ⬆️ 2 kB Support
SVGO v2 is not officially supported, please consider upgrading to SVGO v4 instead. We've backported this fix as there are security implications, but there is no commitment to do this for more complex changes in future.
Consider reading our Migration Guide from v2 to v3 and Migration Guide from v3 to v4 which should ease the process.
2.8.0
2 Nov 2021Added --no-color flag for testing purposes but you may find it useful (#1588)
Handle url() in style attributes properly (#1592)
removeXMLNS plugin now removes
xmlns:xlinkattribute (#1508)
If you enjoy SVGO and would like to support our work, consider sponsoring us directly via our OpenCollective.
Join us in our discord
Features and bug fixes
Added --no-color flag for testing purposes but you may find it useful (#1588)
Handle url() in style attributes properly (#1592)
removeXMLNS plugin now removes
xmlns:xlinkattribute (#1508)Load .cjs configuration only with
requireto fix segfaults in linux (#1605)
Refactorings
Simplified and covered with types svg stringifier (#1593)
Migrated to visitor api and covered with types removeEmptyAttrs plugin (#1594)
Migrated to visitor api and covered with types inlineStyles plugin (#1601)
Migrated to picocolors (#1606)
DX
I found some users are trying to enable plugins which are not part of default preset, for example
{ name: 'preset-default', params: { overrides: { cleanupListOfValues: true } } }To fix this I made docs more concrete about plugin (5165ccb)
and introduced a warning when true is specified in overrides (cb7e9be).
Please give us feedback if you still have issues.2.7.0
23 Sep 2021If you enjoy SVGO and would like to support our work, consider sponsoring us directly via our OpenCollective.
Join us in our discord
ES Modules support
This release adds support for es modules in svgo.config.js when package.json type field is "module".
For projects with mixed cjs and esm svgo.config.mjs and svgo.config.cjs are also supported as fallback.See #1583
export default { plugins: [ 'preset-default' ] }Fixes
Added validation to removeAttrs plugin (#1582)
Refactorings
Follwing plugins are migrated to the new visitor plugin api and covered with tsdoc
Other internal changes
2.6.0
13 Sep 2021If you enjoy SVGO and would like to support our work, consider sponsoring us directly via our OpenCollective.
We have some good stuff in this release
Better syntax errors (#1553)
Before people struggled to figure out what and why happens with such cryptic error
Error: Error in parsing SVG: Unquoted attribute value Line: 1 Column: 29 Char: 6 File: input.svg
This gives too little information when a lot of svgs are transformed.
New errors look like this, include context and point to exact location with the issue.
We hope this will solve many issues when dealing with bundlers and other tools integrations.Error: SvgoParserError: input.svg:2:29: Unquoted attribute value 1 | <svg viewBox="0 0 120 120"> > 2 | <circle fill="#ff0000" cx=60.444444" cy="60" r="50"/> | ^ 3 | </svg> 4 |pefixIds plugin is now idempotent (#1561)
To get better compression results SVGO uses multipass option. This option is used
to run prefixIds plugin only once to prefix ids and classes properly.Though sometimes users run svgo manually a few times which leads to duplicated
prefixes and make code much bigger. To solves this prefixIds was redesigned
to add prefix only when it does not exit in ids and classes.Eventually all plugins are planned to be determenistic and idempotent
so multipass option would not be necessary and single pass compression
could be as effective as possible.New js2svg options (#1546)
js2svg.eol: 'lf' | 'crlf'
Allows to customize end of line characters which is usually resolved by os.EOL in node.
finalNewline: boolean
Ensures SVG output has a final newline which is required for some tools like git.
Fixes and refactorings
Follwing plugins are migrated to the new visitor plugin api and covered with tsdoc
reusePaths (#1551)
removeUselessStrokeAndFill (#1549)
minifyStyles (#1552)
cleanupIDs (#1556)
removeEditorsNSData (#1557)
removeUnusedNS (#1559)
prefixIds (#1561)
sortAttrs (#1564)
Also fixed a few bugs
2.5.0
28 Aug 2021Fixed removing transform-origin attribute (680e143)
Fixed applying transform to path arc with zero radius (ac8edba)
addAttributesToSVGElement
In this release we have a couple of fixes
Fixed removing transform-origin attribute (680e143)
Fixed applying transform to path arc with zero radius (ac8edba)
Visitor api now get parentNode in enter and exit callback
return { element: { enter: (node, parentNode) => { }, exit: (node, parentNode) => { } } }And a lot of plugins are migrated to visitor api and covered them with tsdoc
addAttributesToSVGElement
addClassesToSVGElement
cleanupAttrs
cleanupEnableBackground
cleanupListOfValues
cleanupNumericValues
convertColors
convertEllipseToCircle
convertShapeToPath
convertTransform
mergePaths
removeAttributesBySelector
removeAttrs
removeComments
removeDesc
removeDoctype
removeElementsByAttr
removeEmptyText
removeMetadata
removeRasterImages
removeScriptElement
removeStyleElement
removeTitle
removeXMLProcInst
removeHiddenElems
removeViewBox
removeUselessDefs
removeOffCanvasPaths
removeUnknownsAndDefaults
sortDefsChildren
2.4.0
13 Aug 2021- Removed
Remove more spaces around flag in arc command #1484
Performance is improved by ~37% for svg with styles (#1456)
Reset cursor after "closeto" command when applying transformation (9e578b5)
Hey everybody!
In this release I happy to introduce the new plugin "preset-default" which allows to declaratively setup and customize default set of plugins. Previous solution
extendDefaultPluginsutility prevented parcel users from using cachable json config, svgo-loader and svgo-jsx required svgo to be installed locally. "preset-default" plugin is just another builtin plugi.module.exports = { plugins: [ { name: 'preset-default', params: { overrides: { // customize options builtinPluginName: { optionName: 'optionValue', }, // or disable plugins anotherBuiltinPlugin: false, }, }, }, ], };We also fixed a few bugs
Performance is improved by ~37% for svg with styles (#1456)
Reset cursor after "closeto" command when applying transformation (9e578b5)
Fixed usage of removed internal methods (#1479)
Chalk is replaced with smaller colorette (#1511)
Test files are excluded from published package (#1458)
- Removed
Remove more spaces around flag in arc command #1484
2.3.0
28 Mar 2021The new plugin is added for merging style elements into one. See #1381
CLI got new
--excludeflag which uses regexps to exclude some files from--folder. See #1409Internal AST is migrated to XAST. This spec makes maintaining plugins easier and may be used as interop with other tools like SVGR.
Hey, everybody! We have a big release here.
The new plugin is added for merging style elements into one. See #1381
Before:
<svg> <style media="print"> .st0{ fill:red; padding-top: 1em; padding-right: 1em; padding-bottom: 1em; padding-left: 1em; } </style> <style> .test { background: red; } </style> </svg>After:
<svg> <style> @media print{ .st0{ fill:red; padding-top: 1em; padding-right: 1em; padding-bottom: 1em; padding-left: 1em; } } .test { background: red; } </style> </svg>CLI got new
--excludeflag which uses regexps to exclude some files from--folder. See #1409
svgo --folder=svgs --exclude "invalid-icon" "bad-.+"
Internal AST is migrated to XAST. This spec makes maintaining plugins easier and may be used as interop with other tools like SVGR.
The new visitor plugin type combines features of "full", "perItem" and "perItemReverse" plugins without loosing simplicity. Eventually only visitor api will be supported. See #1454
Also small fixes
2.2.1
6 Mar 2021Fixed scientific notation parsing in paths (d6f972c)
Forbade invalid
<style>type attribute in inlineStyles plugin (#1400)Fixed
<style>support in removeHiddenElems plugin (#1399)
This is a big patch with new style computing (#1399) and landed to master regression tests
A lot of bugs are fixed
Fixed scientific notation parsing in paths (d6f972c)
Forbade invalid
<style>type attribute in inlineStyles plugin (#1400)Fixed
<style>support in removeHiddenElems plugin (#1399)Fixed noSpaceAfterFlags option support (0e02fd9)
Fixed floatPrecision when extending default plugins (d58a7e6)
Fixed
<style>support when removing useless path commands (c21fef5)Fixed
<style>support when combining path commands (ba7e9bd)Prevent removing filter primitive defaults (555a961)
Prevent merging paths with markers (de4fd79)
Prevent removing single point paths with markers (21c04e4)
Keep empty
<pattern>when at least one argument is present (0e6b0c4)Keep
<marker>with display none (d3e3726)Preserve empty conditional processing attributes (a2b0e73)
Preserve viewBox in nested
<svg>(28c01cf)
435 of 526 regression tests are passing
2.2.0
1 Mar 2021Fixed optimisation when stroke-linecap=round is specified (7901588)
Prevented transform applying when inline style is present (79dbb4b)
Apply transform to stroke-dasharray and stroke-dashoffset (dd37fcf)
Wow, two minor releases in a row. There is a big reason for that. We got a new logo! See it in readme. Big thanks to @DerianAndre.
There were also implemented brand new path data parser and stringifier (#1378 and #1387) to do more reliable transformations and produce smaller svg.
A cup of small fixes
Fixed optimisation when stroke-linecap=round is specified (7901588)
Prevented transform applying when inline style is present (79dbb4b)
Apply transform to stroke-dasharray and stroke-dashoffset (dd37fcf)
Fixed removing hidden elements when descendant enables visibility (d06747a)
Fixed removing elements with zero opacity inside clipPath (9d67586)
Fixed removing empty mask which can hide elements by id (d14315b)
Fixed removing stroke-width when marker-end is specified (3639156)
Fixed
<tspan>inside<a>(091172a)
2.1.0
23 Feb 2021We forked sax parser to fix issues inaccessible from public api (github.com/svg/sax)
We added regression tests which already caught 4 bugs (WIP)
Fixed empty
<svg />with enabled cleanupIDs plugin (9b97e06)
This release introduced two big changes
We forked sax parser to fix issues inaccessible from public api (github.com/svg/sax)
We added regression tests which already caught 4 bugs (WIP)
See fixed bugs
Fixed empty
<svg />with enabled cleanupIDs plugin (9b97e06)Fail when file specified in
--configflag does not exist or json string is specified (a855b40)Disabled convertStyleToAttrs by default (#1365)
Preserve whitespace in elements containing text (#1220)
Fixed removing
xml:space="preserve"(776ec1e)Preserve whitespace in nested textual elements (9de471a)
Keep empty
<g>whenfilterattribute is specified (c1d5f0f)
2.0.3
20 Feb 2021Reduced browser build size 1450kB -> 820kB (82778c8)
Fixed adding empty
<defs>by reusePaths plugin (#1201)Fixed reporting parsing errors (ea82cc2)
Reduced browser build size 1450kB -> 820kB (82778c8)
Fixed adding empty
<defs>by reusePaths plugin (#1201)Fixed reporting parsing errors (ea82cc2)
Fixed convertEllipseToCircle plugin when
rxorryattributes are not specified (7f4e052)Fixed removing mask-type on
<mask>(4490d62)Fixed removing elements when class is empty in removeElementsByAttr plugin (d9f68d3)
Disable removing spaces in
<path>by default to support many broken non-browser environments (#1353)Fixed error message in addAttributesToSVGElement plugin (c1edce4)
2.0.2
19 Feb 20212.0.1
18 Feb 20212.0.0
17 Feb 2021Smaller install size
Simplified config format
Added browser ready es module bundle
Happy to introduce SVGO 2.0. Package size was drastically reduced. Configuration
is heavily simplified. Node 10.13+ is required.Smaller install size
Simplified config format
Added browser ready es module bundle
API is synchronous
Support only svgo.config.js for external configuration
Config changes
Since early versions plugins configuration was affected by yaml syntax.
Though it was not practial in json or javascript for writing and for internal
work.plugins: - removeViewBox: true - removeAttr: attrs: '(fill|stroke)'{ plugins: [ { removeViewBox: true }, { removeAttr: { attrs: '(fill|stroke)' } } ] }In the new version plugins configuration is closer to internal representation.
{ plugins: [ { name: 'removeViewBox' }, { name: 'removeAttr', params: { attrs: '(fill|stroke)' } } ] }In v1
fullflag allowed to disable all default plugins and run only specified
in plugins list. In v2 it's default behaviour. To extend default plugins list
you can useextendDefaultPluginsutility.{ plugins: extendDefaultPlugins([ { name: 'removeViewBox', active: false, } ]) }Loading custom plugin by path was removed in favour of manual import or require.
+const customPlugin = require('./custom-plugin.js') { plugins: [ { name: 'customPlugin', - path: './custom-plugin.js' + ...customPlugin } ] }CLI changes
Painful
coawas replaced with well maintainedcommander.--enableand--disableflags are removed. In later versions we will explore
plugins setup via CLI.Inlined json config is no longer suppored. CLI flags should be used instead.
--config="{multipass:true}"By default SVGO CLI will search for
svgo.config.js.--configflag allows
to specify js config with any name.YAML and JSON configuration is no longer supported for the sake of simplicity
and less dependencies.Node API changes
Initially SVGO was implemented with callback style api to fit sax recommendation.
Though in practice api was synchronous and allowed to access the result assigned
in callback right after optimisation.For v1 callback style was replaced with promise api which cannot longer be run
synchronously. This was a pain point for many tools and required hacking svgo.In v2 this pain is considered and api is now synchronous. No hacks necessary.
SVGO class is replaced with
optimizefunction.-const { SVGO } = require('svgo') -const svgo = new SVGO({ - // config - multipass: true -}) -svgo.optimize(svgstring, { path: './file.svg' }).then(result => { - ... -}) +const { optimize, extendDefaultPlugins } = require('svgo') +optimize(svgstring, { + path: './file.svg', + multipass: true, +})Some tools require the same logic for resolving svgo config as SVGO CLI.
const { loadConfig, optimize } = require('svgo') ... const config = await loadConfig() optimize(svgstring, { path: './file.svg', ...config })Browser ready bundle
There were a lot of request for this feature in the past.
Now tools like svgomg may use official and tested es module for browsers withoptimize,extendDefaultPluginsandcreateContentItemsupport.import { optimize, extendDefaultPlugins, createContentItem } from 'svgo/dist/svgo.browser.js'- 1.x
1.3.2
30 Oct 2019Fixed TypeError: Cannot set property 'multipassCount' of undefined
1.3.1
29 Oct 2019prefixIdsplugin now runs only once with--multipassoptioncleanupIDsplugin is prevented from producing a preserved ID, including one which matches a preserved prefix, when minifying
1.3.0
14 Jul 2019Custom plugins now can be loaded from external js through
pathplugin param.New plugin
convertEllipseToCircleto convert ellipse with equal radius measures to circleNew plugin
sortDefsChildrenfor improved compression
Custom plugins now can be loaded from external js through
pathplugin param.New plugin
convertEllipseToCircleto convert ellipse with equal radius measures to circleNew plugin
sortDefsChildrenfor improved compressionSVGO now removes unnecessary spaces after
arctopath command flags.removeDimensionsplugin now addsviewBoxif it's missingFixed
removeUnusedNSnot counting attributes in<svg>tag itself.Fixed an issue with incorrect processing multiple images
Fixed an error with incorrect converting multiple segmented curve to an arc.
Fixed an error with matrix decomposition in
convertTransformdue to rounding error leading to illegal value.Added
forceoption formergePathspluginAdded options to
prefixIdsplugin for selectively prefixing IDs and/or classesExported config function
1.2.2
16 Apr 2019- Security
Update js-yaml for Code Injection warning
1.2.1
4 Apr 2019- Security
Bump up js-yaml version to fix DoS vulnerability
Some goodness from pull-requests.
- Security
Bump up js-yaml version to fix DoS vulnerability
1.2.0
24 Feb 2019Fixed extra blank lines when processing many files
Added
--recursiveoption to process folders recursevely with option-fAdded
removeAttributesBySelectorplugin to remove elements matching a css selector
Some goodness from pull-requests.
Fixed extra blank lines when processing many files
Added
--recursiveoption to process folders recursevely with option-fAdded
removeAttributesBySelectorplugin to remove elements matching a css selectorAdded
removeOffCanvasPathsplugin to remove elements outside of the viewboxremoveAttrsplugin: addedpreserveCurrentColorcolorAdded
reusePathsplugin to replace duplicated elements with linkAdded support of comma-separated plugins list in
--disableand--enableoptionsAdded option to preserve IDs based on prefix in
cleanupIDspluginReplaced
colorsdependency withchalk
1.1.1
17 Sep 2018Fixed crash in
SVGO.optimize()when ‘info’ is absent.Removed extra space after
cleanupListOfValuesplugin.
1.1.0
16 Sep 2018Fixed
collapseGroupsplugin removing property with a child havinginheritvalue.versionattribute value is not more being rounded.Fixed jsAPI
clonemethod with respect to the introduced CSS classes.
Fixed
collapseGroupsplugin removing property with a child havinginheritvalue.versionattribute value is not more being rounded.Fixed jsAPI
clonemethod with respect to the introduced CSS classes.Fixed scaling strokes with
vector-effect="non-scaling-stroke"Fixed passing properties from groups in
collapseGroupsplugin if child have a filterFixed arc path commands parsing without separators after flags, effectively producing a JS error.
Fixed
viewBoxseparators parsing.Fixed
removeNonInheritableGroupAttrsplugin to work as intended.Fixed removing path segments without length in presence of
stroke-linecap.Fixed
removeUnknownsAndDefaultsplugin removing attributes from elements withid.Fixed converting to large arcs from nearly straight lines curves.
Fixed
collapseGroupsplugin affecting<switch>and its subgroups.Fixed
convertTransformplugin converting torotate()with wrong sign in some case.Fixed
cleanupListOfValuesplugin not preserving non-numeric values.Fixed
!importantbeing passed to attributes inconvertStyleToAttrsplugin.Added option
keepImportanttoconvertStyleToAttrsplugin to preserve styles with!important.removeHiddenElemsplugin now also removes elements withvisibility="hidden"attributeAdded
forceAbsolutePathoption toconvertPathDataplugin to always use absolute coordinatesAdded
keepRoleAttrforremoveUnknownsAndDefaultsplugin to preserverole-attributesAdded
xmlnsorder option insortAttrspluginAdded an option to
prefixIdsplugin to pass prefix as false or as a function that returns falseprefixIdsplugin now adds prefix to every classUpdated and improved docs a bit (multiple authors).
1.0.5
26 Feb 2018Fixed issue with prefixIDs plugin not replacing url() values correctly
1.0.4
30 Jan 2018Fixed bug with removing groups that are direct child of
<switch>.Fixed bug with shorthand path points counting (thanks @alexjlockwood for noticing).
Fixed crash on parsing invalid transform, e.g. without close parenthesis.
1.0.3
8 Nov 2017Fixed
removeViewBoxplugin to check for zero start coordinates.Removed extra info from STDOUT when it set to output.
1.0.2
3 Nov 2017Fixed a couple of errors related to
inlineStylesplugin.Updated some lost details in documentation to reflect v1.0 changes.
A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.