Skip to content

Instantly share code, notes, and snippets.



Last active Mar 26, 2021
What would you like to do?
SVGO config file
multipass: true
- addAttributesToSVGElement: false
- addClassesToSVGElement: false
- cleanupAttrs: true
- cleanupEnableBackground: true
- cleanupIDs: true
- cleanupListOfValues: true
- cleanupNumericValues:
floatPrecision: 2
- collapseGroups: true
- convertColors: true
- convertPathData: true
- convertShapeToPath: true
- convertStyleToAttrs: true
- convertTransform: true
- mergePaths: true
- minifyStyles: true
- moveElemsAttrsToGroup: true
- moveGroupAttrsToElems: true
- removeAttrs: true
- removeComments: true
- removeDesc: true
- removeDimensions: true
- removeDoctype: true
- removeEditorsNSData: true
- removeElementsByAttr: true
- removeEmptyAttrs: true
- removeEmptyContainers: true
- removeEmptyText: true
- removeHiddenElems: true
- removeMetadata: true
- removeNonInheritableGroupAttrs: true
- removeRasterImages
- removeStyleElement: true
- removeTitle: true
- removeUnknownsAndDefaults: true
- removeUnusedNS: true
- removeUselessDefs: true
- removeUselessStrokeAndFill: true
- removeViewBox: true
- removeXMLNS: false
- removeXMLProcInst: true
- sortAttrs: true
- transformsWithOnePath: true
pretty: true
indent: ' '

This comment has been minimized.

Copy link

@torkleyy torkleyy commented Aug 9, 2019

Thank you!

FYI, transformsWithOnePath seems to no longer exist: svg/svgo@8354897


This comment has been minimized.

Copy link

@tomchen tomchen commented Jul 16, 2020

Thank you. I've been using this config for a while.

Just one thing. removeElementsByAttr normally has detailed parameters to specify by what attributes you want to remove the elements:

(json format)

removeElementsByAttr: { id: ['invisible'] }

But with

removeElementsByAttr: true

it seems SVGO removes all elements without any attributes (or with class only?).

An element without any attributes (or with class only?) is perfectly valid and this removal is likely not what you want.

So anyone who uses this could switch removeElementsByAttr to false

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment