Remove XML Namespace
Removes the xmlns
attribute from the top-most <svg>
element in the document.
It's recommended to use this plugin if you intend to inline SVGs into an HTML document. HTML does not support explicit namespaces, so these are ignored by the browser anyway.
TIP
This plugin pairs well with the Remove XLink plugin. Remove XLink drops XLink namespaces and migrates references to them to the modern equivalent, supported by SVG 2 and inline an HTML document. When using this, it's recommended to enable Remove XLink too.
WARNING
This plugin renders SVGs unusable as standalone assets, in HTML <img>
elements, or CSS pseudo-elements.
Usage
js
module.exports = {
plugins: ["removeXMLNS"],
};
module.exports = {
plugins: ["removeXMLNS"],
};
Demo
Implementation
https://github.com/svg/svgo/blob/main/plugins/removeXMLNS.js