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 be different from the default preset.
Plugins List
The following plugins are included in preset-default
, in the order that they're executed:
- Remove Doctype
- Remove XML Declaration
- Remove Comments
- Remove Metadata
- Remove Editor Namespace Data
- Cleanup Attributes
- Merge Styles
- Inline Styles
- Minify Styles
- Cleanup IDs
- Remove Useless Defs
- Cleanup Numeric Values
- Convert Colors
- Remove Unknowns and Defaults
- Remove Non-inheritable Group Attributes
- Remove Useless Stroke and Fill
- Remove ViewBox
- Cleanup Enable Background
- Remove Hidden Elements
- Remove Empty Text
- Convert Shape to Path
- Convert Ellipse to Circle
- Move Element Attributes to Group
- Move Group Attributes to Element
- Collapse Groups
- Convert Path Data
- Convert Transform
- Remove Empty Attributes
- Remove Empty Containers
- Remove Unused Namespaces
- Merge Paths
- Sort Attributes
- Sort Defs Children
- Remove Title
- Remove Description
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 also drop default-preset
entirely, and configure your own plugin pipeline from scratch, with only the desirable plugins:
module.exports = {
plugins: [
'removeDoctype',
'removeXMLProcInst',
'minifyStyles',
'sortAttrs',
'sortDefsChildren',
],
};