From 15688fc08fbb7335702e836adc6a802202ee29d4 Mon Sep 17 00:00:00 2001 From: Panayiotis Lipiridis Date: Fri, 21 Sep 2018 17:32:52 +0300 Subject: [PATCH] Use svgo to format svg files --- package.json | 2 ++ svgo.yml | 8 ++++++++ yarn.lock | 39 +++++++++++++++++++++++++++++++++++++-- 3 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 svgo.yml diff --git a/package.json b/package.json index ab6c58a506e24..6d3c97f7a2908 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,7 @@ "prettier": "^1.12", "prettier-eslint-cli": "4.7.1", "rimraf": "^2.6.1", + "svgo": "^1.1.1", "yaml-lint": "^1.2.4", "yargs": "^10.0.3" }, @@ -57,6 +58,7 @@ "format-scripts": "prettier-eslint --write \"scripts/**/*.js\"", "format-www": "prettier-eslint --write \"www/*.js\" \"www/src/**/*.js\"", "format-integration": "prettier-eslint --write \"integration-tests/**/src/**/*.js\" \"integration-tests/**/cypress/**/*.js\"", + "format-svg": "find static | grep '\\.svg$' | xargs -Iz -n 1 svgo --pretty --indent=2 --config=svgo.yml z", "jest": "jest", "lerna": "lerna", "lerna-prepare": "lerna run prepare", diff --git a/svgo.yml b/svgo.yml new file mode 100644 index 0000000000000..d3ec7e0be046d --- /dev/null +++ b/svgo.yml @@ -0,0 +1,8 @@ +plugins: + - collapseGroups: true + - removeDesc: true + - removeScriptElement: true + - removeStyleElement: true + - removeTitle: true + - removeUselessDefs: true + - removeViewBox: false diff --git a/yarn.lock b/yarn.lock index aba3cd63d4ab2..9e5c6edf134e3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4978,6 +4978,15 @@ css-select@^1.1.0, css-select@~1.2.0: domutils "1.5.1" nth-check "~1.0.1" +css-select@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/css-select/-/css-select-2.0.0.tgz#7aa2921392114831f68db175c0b6a555df74bbd5" + dependencies: + boolbase "^1.0.0" + css-what "2.1" + domutils "^1.7.0" + nth-check "^1.0.1" + css-select@~1.3.0-rc0: version "1.3.0-rc0" resolved "https://registry.yarnpkg.com/css-select/-/css-select-1.3.0-rc0.tgz#6f93196aaae737666ea1036a8cb14a8fcb7a9231" @@ -4999,6 +5008,13 @@ css-selector-tokenizer@^0.7.0: fastparse "^1.1.1" regexpu-core "^1.0.0" +css-tree@1.0.0-alpha.28: + version "1.0.0-alpha.28" + resolved "https://registry.yarnpkg.com/css-tree/-/css-tree-1.0.0-alpha.28.tgz#8e8968190d886c9477bc8d61e96f61af3f7ffa7f" + dependencies: + mdn-data "~1.1.0" + source-map "^0.5.3" + css-tree@1.0.0-alpha.29: version "1.0.0-alpha.29" resolved "https://registry.yarnpkg.com/css-tree/-/css-tree-1.0.0-alpha.29.tgz#3fa9d4ef3142cbd1c301e7664c1f352bd82f5a39" @@ -5821,7 +5837,7 @@ domutils@1.5.1: dom-serializer "0" domelementtype "1" -domutils@^1.5.1: +domutils@^1.5.1, domutils@^1.7.0: version "1.7.0" resolved "https://registry.yarnpkg.com/domutils/-/domutils-1.7.0.tgz#56ea341e834e06e6748af7a1cb25da67ea9f8c2a" dependencies: @@ -9694,7 +9710,7 @@ js-yaml@3.11.0: argparse "^1.0.7" esprima "^4.0.0" -js-yaml@^3.10.0, js-yaml@^3.11.0, js-yaml@^3.5.2, js-yaml@^3.7.0, js-yaml@^3.9.0, js-yaml@^3.9.1: +js-yaml@^3.10.0, js-yaml@^3.11.0, js-yaml@^3.12.0, js-yaml@^3.5.2, js-yaml@^3.7.0, js-yaml@^3.9.0, js-yaml@^3.9.1: version "3.12.0" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.12.0.tgz#eaed656ec8344f10f527c6bfa1b6e2244de167d1" dependencies: @@ -15502,6 +15518,25 @@ svgo@^1.0.0: unquote "~1.1.1" util.promisify "~1.0.0" +svgo@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/svgo/-/svgo-1.1.1.tgz#12384b03335bcecd85cfa5f4e3375fed671cb985" + dependencies: + coa "~2.0.1" + colors "~1.1.2" + css-select "^2.0.0" + css-select-base-adapter "~0.1.0" + css-tree "1.0.0-alpha.28" + css-url-regex "^1.1.0" + csso "^3.5.0" + js-yaml "^3.12.0" + mkdirp "~0.5.1" + object.values "^1.0.4" + sax "~1.2.4" + stable "~0.1.6" + unquote "~1.1.1" + util.promisify "~1.0.0" + sw-precache@^5.2.0: version "5.2.1" resolved "https://registry.yarnpkg.com/sw-precache/-/sw-precache-5.2.1.tgz#06134f319eec68f3b9583ce9a7036b1c119f7179"