Back to Svgo

cleanupIds

docs/04-plugins/cleanupIds.mdx

4.0.11.0 KB
Original Source

Removes unused IDs, and minifies IDs that are referenced by other elements.

By default, we back off from removing and minifying IDs if a <script> or <style> element is present in the document. You can bypass this behavior by setting the force parameter to true.

:::info

Between v2 and v3, the plugin was renamed from cleanupIDs to cleanupIds, if you've recently migrated and having issues, please double-check the capitalization!

:::

:::caution

This plugin has been known to cause problems when inlining multiple SVGs in the same parent document. Due to the predictable algorithm used to minify IDs, separate documents that are run though SVGO may end up with clashing IDs.

You can work around this by enabling the prefixIds plugin. Alternatively, you can set the minify parameter to false, however this will not resolve the issue if your SVGs already had clashing IDs to start with.

See facebook/docusaurus#8297 for more context.

:::