Skip to content

Commit

Permalink
CI: Add svgo pre-commit hook
Browse files Browse the repository at this point in the history
  • Loading branch information
Repiteo committed Jun 23, 2024
1 parent 04bf7d4 commit 4af1068
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@ indent_size = 4
[*.{yml,yaml}]
indent_style = space
indent_size = 2

[*.svg]
insert_final_newline = false
8 changes: 8 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,14 @@ repos:
pass_filenames: false
additional_dependencies: ['jsdoc@^4.0.3']

- id: svgo
name: svgo
language: node
entry: svgo
files: \.svg$
args: [--quiet, --config, misc/utility/svgo.config.mjs]
additional_dependencies: ["[email protected]"]

- id: copyright-headers
name: copyright-headers
language: python
Expand Down
20 changes: 20 additions & 0 deletions misc/utility/svgo.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
export default {
multipass: true,
precision: 2,
plugins: [
{
name: "preset-default",
params: {
overrides: {
removeHiddenElems: false,
convertPathData: false,
},
},
},
"convertStyleToAttrs",
"removeScriptElement",
"removeStyleElement",
"reusePaths",
"sortAttrs",
],
};

0 comments on commit 4af1068

Please sign in to comment.