Browse Source

added full svgo.yaml config; now removes unknowns but still keeps defaults

telamonian 5 years ago
parent
commit
4647b3c1e7
2 changed files with 77 additions and 1 deletions
  1. 1 1
      packages/ui-components/package.json
  2. 76 0
      packages/ui-components/svgo.yaml

+ 1 - 1
packages/ui-components/package.json

@@ -28,7 +28,7 @@
   "scripts": {
     "build": "tsc -b",
     "clean": "rimraf lib",
-    "cleansvg": "svgo --pretty --indent=2 --disable=collapseGroups,moveGroupAttrsToElems,removeUnknownsAndDefaults,removeViewBox",
+    "cleansvg": "svgo --config svgo.yaml",
     "docs": "typedoc src",
     "prepublishOnly": "npm run build",
     "storybook": "start-storybook -p 9001 -c .storybook",

+ 76 - 0
packages/ui-components/svgo.yaml

@@ -0,0 +1,76 @@
+# replace default config
+
+# multipass: true
+full: true
+
+plugins:
+
+  # - name
+  #
+  # or:
+  # - name: false
+  # - name: true
+  #
+  # or:
+  # - name:
+  #     param1: 1
+  #     param2: 2
+
+  - removeDoctype
+  - removeXMLProcInst
+  - removeComments
+  - removeMetadata
+  - removeXMLNS
+  - removeEditorsNSData
+  - cleanupAttrs
+  - inlineStyles
+  - minifyStyles
+  - convertStyleToAttrs
+  - cleanupIDs
+  - prefixIds
+  - removeRasterImages
+  - removeUselessDefs
+  - cleanupNumericValues
+  - cleanupListOfValues
+  - convertColors
+  - removeUnknownsAndDefaults:
+      defaultAttrs: false
+  - removeNonInheritableGroupAttrs
+  - removeUselessStrokeAndFill
+  # - removeViewBox
+  - cleanupEnableBackground
+  - removeHiddenElems
+  - removeEmptyText
+  - convertShapeToPath
+  - convertEllipseToCircle
+  - moveElemsAttrsToGroup
+  # - moveGroupAttrsToElems
+  # - collapseGroups
+  - convertPathData
+  - convertTransform
+  - removeEmptyAttrs
+  - removeEmptyContainers
+  - mergePaths
+  - removeUnusedNS
+  - sortAttrs
+  - sortDefsChildren
+  - removeTitle
+  - removeDesc
+  - removeDimensions
+  - removeAttrs
+  - removeAttributesBySelector
+  - removeElementsByAttr
+  - addClassesToSVGElement
+  - removeStyleElement
+  - removeScriptElement
+  - addAttributesToSVGElement
+  - removeOffCanvasPaths
+  - reusePaths
+
+# configure the indent (default 4 spaces) used by `--pretty` here:
+#
+# @see https://github.com/svg/svgo/blob/master/lib/svgo/js2svg.js#L6 for more config options
+#
+js2svg:
+ pretty: true
+ indent: '  '