removeEditorsNSData
Default
Removes all XML namespaces, elements, and attributes associated with popular vector editing software.
This plugin is completely safe to use before redistributing your SVG or incorporating it into a larger document.
The kinds of elements that are removed are usually editor specific workspace settings. You should keep a backup of your original SVG to preserve that meta-data and continue to maintain your SVG, while you serve the optimized version to users.
You can find a list of removed editor namespaces in _collections.js, which includes software like Inkscape, Adobe Illustrator, and Figma.
Usage
- Basic
- Parameters
svgo.config.js
module.exports = {
plugins: [
"removeEditorsNSData"
]
}
svgo.config.js
module.exports = {
plugins: [
{
name: "removeEditorsNSData",
params: {
additionalNamespaces: []
}
}
]
}
Parameters
additionalNamespacesIf you want to remove additional XML namespaces, you can provide them in a list.
Demo
Live Editor
const svg = ` <?xml version="1.0" encoding="UTF-8"?> <svg xmlns="http://www.w3.org/2000/svg" viewBox=" 0 0 150 100 " width="150"> <!-- Created with love! --> <defs> <ellipse cx="50" cy="50.0" rx="50.00" ry="auto" fill="black" id="circle"/> </defs> <g> <use href="/?originalUrl=https%3A%2F%2Fsvgo.dev%2F%26quot%3B%23circle%26quot%3B%2520transform%3D%26quot%3BskewX(16)%26quot%3B%2F"> <rect id="useless" width="0" height="0" fill="#ff0000"/> </g> </svg> `; const svgoConfig = { js2svg: { indent: 2, pretty: true }, plugins: [ "removeEditorsNSData" ] } render(<SvgoPreview svg={svg} svgoConfig={svgoConfig}/>);
Result
Loading...