Check SVG optimization in the tests CI workflow with SVGO (#9361)

* Check SVG optimization in the tests CI workflow with SVGO

Previously it was only recommended by the documentation that SVG images should be optimized using [SVGOMG](https://github.com/jakearchibald/svgomg), the web GUI version of https://github.com/svg/svgo (CLI)


Now all SVG images are optimized, and optimization is mandatory enforced by the tests CI workflow.
\+ SVGs are sanitized of potentially malicious JS code using the https://svgo.dev/docs/plugins/removeScripts/ plugin

* Output prettified SVGs instead and remove unchanged files from stdout

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>

* Use `removeScripts` SVGO plugin to reduce risk of malicious SVGs

* Move the CLI options to the JS config instead

* Disable `removeComments` plugin included in the default preset

* editorconfig, and easier config

---------

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
This commit is contained in:
InverleandAlexandre Alapetite authored and GitHub committed 2026-09-29 16:18:01 +02:00
1 parent 84023d443e
commit 0285dc8970
141 files changed
+663 -1237

No files matched your search

+3
View File
@@ -85,6 +85,9 @@ jobs:
- name: Check Right-to-left CSS
run: npm run --silent rtlcss && git diff --exit-code
- name: Optimize SVG image files
run: npm run --silent svgo && git diff --exit-code
# Shell tests
- name: Use shell cache