Preset Default
SVGO runs with a default preset that has the plugin ID preset-default
. This is the default set of plugins that are used when not explicitly specified or overridden elsewhere.
If you aren't using SVGO directly, like through SVGR, the default plugins may differ from the default preset.
Plugins List
The following plugins are included in preset-default
, in the order that they're executed:
- removeDoctype
- removeXMLProcInst
- removeComments
- removeMetadata
- removeEditorsNSData
- cleanupAttrs
- mergeStyles
- inlineStyles
- minifyStyles
- cleanupIds
- removeUselessDefs
- cleanupNumericValues
- convertColors
- removeUnknownsAndDefaults
- removeNonInheritableGroupAttrs
- removeUselessStrokeAndFill
- removeViewBox
- cleanupEnableBackground
- removeHiddenElems
- removeEmptyText
- convertShapeToPath
- convertEllipseToCircle
- moveElemsAttrsToGroup
- moveGroupAttrsToElems
- collapseGroups
- convertPathData
- convertTransform
- removeEmptyAttrs
- removeEmptyContainers
- removeUnusedNS
- mergePaths
- sortAttrs
- sortDefsChildren
- removeTitle
- removeDesc
Disable a Plugin
Sometimes a specific plugin might not be appropriate for your workflow. You can continue using preset-default
while disabling any plugin by using the overrides
parameter.
In overrides
, reference the plugin ID and set it to false
to disable it:
module.exports = {
plugins: [
{
name: 'preset-default',
params: {
overrides: {
removeViewBox: false,
},
},
},
],
};
Alternatively, you can drop preset-default
entirely, and configure your own plugin pipeline from scratch, with only the desirable plugins:
module.exports = {
plugins: [
'removeDoctype',
'removeXMLProcInst',
'minifyStyles',
'sortAttrs',
'sortDefsChildren',
],
};