Skip to content

Instantly share code, notes, and snippets.

@pladaria

pladaria/.svgo.yml

Last active Jul 16, 2020
Embed
What would you like to do?
SVGO config file
multipass: true
plugins:
- 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
js2svg:
pretty: true
indent: ' '
@torkleyy

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

@tomchen

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
You can’t perform that action at this time.