Open lencioni opened 7 years ago
While it's safe, I think I'd prefer no-plugins by default, and allow people to opt-in to plugins they want.
How come? svgo has a lot of plugins enabled by default, and this proposal simply extends that to also include a plugin that is guaranteed to always be applicable in this situation.
I just personally prefer having it be a cleaner zero-opinion pass-through to SVGO.
I've changed my mind on this, I think having sane defaults included in the plugin would be great.
Sounds great!, I've added manually all the svgo default plugins and my .babelrc
looks more like a svgo config file
@emartini can you share your configuration here?
["inline-react-svg", {
"svgo": {
"plugins": [
{ "cleanupAttrs": true },
{ "removeDoctype": true },
{ "removeXMLProcInst": true },
{ "removeComments": true },
{ "removeMetadata": true },
{ "removeDesc": true },
{ "removeUselessDefs": true },
{ "removeEditorsNSData": true },
{ "removeEmptyAttrs": true },
{ "removeHiddenElems": true },
{ "removeEmptyText": true },
{ "removeEmptyContainers": true },
{ "cleanupEnableBackground": true },
{ "minifyStyles": true },
{ "convertStyleToAttrs": true },
{ "convertColors": true },
{ "convertPathData": true },
{ "convertTransform": true },
{ "removeUnknownsAndDefaults": true },
{ "removeNonInheritableGroupAttrs": true },
{ "removeUselessStrokeAndFill": true },
{ "removeUnusedNS": true },
{ "cleanupIDs": true },
{ "cleanupNumericValues": true },
{ "cleanupListOfValues": true },
{ "moveElemsAttrsToGroup": true },
{ "moveGroupAttrsToElems": true },
{ "collapseGroups": true },
{ "mergePaths": true },
{ "convertShapeToPath": true },
{ "removeXMLNS": true },
]
}
}]
The only non default option is removeXMLNS
This plugin removes the
xmlns
attribute from the top-level svg element, which is safe for inline SVGs, which is how all SVGs transformed by this plugin will end up being used. I think it makes sense to enable this plugin by default.https://github.com/svg/svgo/blob/master/plugins/removeXMLNS.js