From 69e1f8df1f9f2a383e35a30b1e20ef5d20692487 Mon Sep 17 00:00:00 2001 From: Waldir Pimenta Date: Fri, 12 Jun 2020 19:17:15 +0100 Subject: [PATCH] Improve svgo.yml - Remove plugins that are already the default in svgo, and link to docs - Move the `removeDimensions` plugin to be next to `removeViewBox` - Add configuration to the `convertPathData` and `mergePaths` plugins to avoid an issue with over-aggressive optimization for arcto commands introduced in svgo v1.3.0. Also: - Add missing `--config` option to the svgo command in README - Remove over-aggressive optimization from the cv.svg flag --- README.md | 2 +- flags/cv.svg | 2 +- svgo.yml | 21 ++++++++++----------- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 724183b..11c6d53 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ First, edit the relevant SVG files in the `flags/` directory. Then run `svgo` to optimize the SVG files: ```sh -svgo ./flags --recursive +svgo ./flags --recursive --config=svgo.yml ``` Then commit the changes, and submit them as a pull request. diff --git a/flags/cv.svg b/flags/cv.svg index 3bf1b2d..e38cde9 100644 --- a/flags/cv.svg +++ b/flags/cv.svg @@ -1 +1 @@ - + \ No newline at end of file diff --git a/svgo.yml b/svgo.yml index 3e84749..1abf2d0 100644 --- a/svgo.yml +++ b/svgo.yml @@ -1,20 +1,12 @@ +# Default options: https://github.com/svg/svgo#what-it-can-do + floatPrecision: 1 multipass: true plugins: -- removeTitle: true -- removeDesc: true -- removeUselessDefs: true -- removeHiddenElems: true +- removeDimensions: true - removeViewBox: false -- removeUnknownsAndDefaults: true -- removeUselessStrokeAndFill: true -- removeUnusedNS: true -- cleanupIDs: true -- cleanupNumericValues: true -- collapseGroups: true - removeRasterImages: true - sortAttrs: true -- removeDimensions: true - removeAttrs: attrs: - 'font.*' @@ -24,3 +16,10 @@ plugins: - 'text.*' - removeStyleElement: true - removeScriptElement: true +# Avoid optimization that breaks some editors/viewers. +# For context, see https://github.com/svg/svgo/issues/1137 +# and https://github.com/HatScripts/circle-flags/pull/4. +- convertPathData: + noSpaceAfterFlags: false +- mergePaths: + noSpaceAfterFlags: false