Skip to content

Commit

Permalink
build, icons: Optimize raw file SVGO config further and re-crush icons
Browse files Browse the repository at this point in the history
Adding further options to general SVGO config including
- new `eol: 'lf'` and
- new `finalNewline: true`
both additions of recent minor SVGO versions. With that deleting the
command line `final-newline` flag.

With comment https://gerrit.wikimedia.org/r/c/design/codex/+/755319/comment/35fbaf55_19418aac/
pointing to svg/svgo#1353 the few added bytes
seem acceptable for better usage of the libraries raw icons. Also in a
far-future we might include Codex icon package raw SVGs as the general
WikimediaUI icon library instead of currently OOUI – exposing them to a
much wider audience. With that people opening those icons in Inkscape
or similar will only become more common.

Therefore re-crushing SVGs with new SVGO config and
adding 'minify:svg' script to 'build:svg'.

Bug: T299738
Change-Id: Ib1b97c793a1c41cde26a83932dca9f64bf67a4a9
  • Loading branch information
Volker-E authored and jenkins-bot committed Jan 25, 2022
1 parent fbfd6a6 commit 783a933
Show file tree
Hide file tree
Showing 172 changed files with 205 additions and 214 deletions.
14 changes: 6 additions & 8 deletions packages/icons/.svgo.config.js
Expand Up @@ -5,7 +5,6 @@
* https://www.mediawiki.org/wiki/Manual:Coding_conventions/SVG#Exemplified_safe_configuration
*/
module.exports = {
multipass: true,
plugins: [
{
// Set of built-in plugins enabled by default.
Expand All @@ -29,13 +28,12 @@ module.exports = {
'sortAttrs',
],
// 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
//
// Unfortunately EOL cannot be configured, SVGO uses the platform's EOL marker.
// On non-unix systems the linebreaks will be normalized to LF (unix) only at git commit,
// assuming `core.autocrlf` is 'true' (default) or 'input'.
// @see https://github.com/svg/svgo/blob/main/lib/svgo/coa.js#L194 for more config options
js2svg: {
indent: "\t",
eol: 'lf',
finalNewline: true,
indent: '\t',
pretty: true,
}
},
multipass: true
}
4 changes: 2 additions & 2 deletions packages/icons/package.json
Expand Up @@ -23,11 +23,11 @@
"build": "npm run build:vite && npm run build:json && npm run build:svg && npm run test:unit -- tests/outputTypes.test.ts --coverage=false",
"build:vite": "vite build",
"build:json": "node ./buildIconsJson.js",
"build:svg": "cp -a src/images dist/",
"build:svg": "npm run minify:svg && cp -a src/images dist/",
"build-if-missing": "test -e dist/codex-icons.json || npm run build",
"lint": "npm run lint:ts",
"lint:ts": "tsc --noEmit --emitDeclarationOnly false",
"minify:svg": "svgo --config=.svgo.config.js --quiet --recursive --folder ./src/images --final-newline",
"minify:svg": "svgo --config=.svgo.config.js --quiet --recursive --folder ./src/images",
"test": "npm run lint && npm run test:unit",
"test:unit": "jest -c .jest/jest.config.json"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/icons/src/images/alert.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 1 addition & 2 deletions packages/icons/src/images/alignCenter.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 1 addition & 4 deletions packages/icons/src/images/alignLeft.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 1 addition & 4 deletions packages/icons/src/images/alignRight.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion packages/icons/src/images/arrowNext.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion packages/icons/src/images/arrowPrevious.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion packages/icons/src/images/article.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion packages/icons/src/images/articleCheck.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion packages/icons/src/images/articleNotFound.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion packages/icons/src/images/articleRedirect.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion packages/icons/src/images/articleSearch.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions packages/icons/src/images/articles.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions packages/icons/src/images/articlesSearch-ltr.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions packages/icons/src/images/articlesSearch-rtl.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion packages/icons/src/images/attachment.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion packages/icons/src/images/bell.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion packages/icons/src/images/bigger.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion packages/icons/src/images/block.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion packages/icons/src/images/book.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion packages/icons/src/images/bookmark.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion packages/icons/src/images/bookmarkOutline.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion packages/icons/src/images/bright.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion packages/icons/src/images/browser.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion packages/icons/src/images/calendar.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion packages/icons/src/images/camera.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion packages/icons/src/images/cancel.svg
2 changes: 1 addition & 1 deletion packages/icons/src/images/chart.svg
2 changes: 1 addition & 1 deletion packages/icons/src/images/check.svg
2 changes: 1 addition & 1 deletion packages/icons/src/images/checkAll.svg
2 changes: 1 addition & 1 deletion packages/icons/src/images/clear.svg
2 changes: 1 addition & 1 deletion packages/icons/src/images/clock.svg
4 changes: 2 additions & 2 deletions packages/icons/src/images/close.svg
4 changes: 2 additions & 2 deletions packages/icons/src/images/code.svg
2 changes: 1 addition & 1 deletion packages/icons/src/images/collapse.svg
2 changes: 1 addition & 1 deletion packages/icons/src/images/die.svg
2 changes: 1 addition & 1 deletion packages/icons/src/images/doubleChevronEnd.svg
2 changes: 1 addition & 1 deletion packages/icons/src/images/doubleChevronStart.svg
2 changes: 1 addition & 1 deletion packages/icons/src/images/downTriangle.svg
2 changes: 1 addition & 1 deletion packages/icons/src/images/download.svg
2 changes: 1 addition & 1 deletion packages/icons/src/images/edit.svg
2 changes: 1 addition & 1 deletion packages/icons/src/images/editLock.svg
2 changes: 1 addition & 1 deletion packages/icons/src/images/editUndo-ltr.svg
2 changes: 1 addition & 1 deletion packages/icons/src/images/editUndo-rtl.svg
2 changes: 1 addition & 1 deletion packages/icons/src/images/expand.svg
2 changes: 1 addition & 1 deletion packages/icons/src/images/eye.svg
4 changes: 2 additions & 2 deletions packages/icons/src/images/eyeClosed.svg

0 comments on commit 783a933

Please sign in to comment.