Skip to content

Instantly share code, notes, and snippets.

@itsmikita
Created February 26, 2024 22:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save itsmikita/287765c94c2fdf0681ffcd8627c7c92d to your computer and use it in GitHub Desktop.
Save itsmikita/287765c94c2fdf0681ffcd8627c7c92d to your computer and use it in GitHub Desktop.
Optimized configuration for optimizing SVGs 🤡
export default {
// js2svg: {
// indent: " ",
// pretty: true
// },
multipass: true,
plugins: [
"cleanupAttrs",
"cleanupEnableBackground",
"cleanupIds",
"cleanupListOfValues",
"collapseGroups",
"convertColors",
"convertPathData",
"convertShapeToPath",
"convertStyleToAttrs",
"convertTransform",
"removeComments",
"removeDesc",
"removeDimensions",
"removeDoctype",
"removeEditorsNSData",
"removeMetadata",
"removeNonInheritableGroupAttrs",
"removeOffCanvasPaths",
"removeRasterImages",
"removeScriptElement",
"removeUnknownsAndDefaults",
"removeUnusedNS",
"removeUselessDefs",
"removeUselessStrokeAndFill",
"removeTitle",
"removeXMLProcInst",
"removeEmptyAttrs",
"removeEmptyContainers",
"removeEmptyText",
"inlineStyles",
"mergeStyles",
"minifyStyles",
"removeStyleElement",
"removeHiddenElems",
{
name: "mergePaths",
params: {
force: true,
noSpaceAfterFlags: true
}
},
"sortAttrs",
{
name: "addAttributesToSVGElement",
params: {
attributes: [
{ focusable: "false" },
{ fill: "currentColor" }
]
}
},
]
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment