commit ac6e97b3f52a323fc6a309d7ae0e9420ff7c670f
parent 5c004cf2dcdeff814f6be256294dc1261e21dc74
Author: Nullptrderef <nullptrderef@proton.me>
Date: Sun, 14 Jan 2024 15:18:09 +0100
initial optimize script, testing
Diffstat:
3 files changed, 24 insertions(+), 0 deletions(-)
diff --git a/contrib/README b/contrib/README
@@ -3,3 +3,7 @@ Design source files are in `git.taler.net:large-media.git` -> `taler-machine.pen
Each page is exported to `ads/svg/*` and `err/svg/*` respectively, which get converted to pngs using `convert-svgs-to-pngs.sh`.
Please do not edit the SVGs directly; edit them in Penpot and re-export them.
+
+convert-svgs-to-pngs depends on:
+- pngng
+- inkscape (or imagemagick if you set an env var; see script)
diff --git a/contrib/optimize-svgs.sh b/contrib/optimize-svgs.sh
@@ -0,0 +1,11 @@
+#!/bin/zsh
+# Calls svgo on all svgs
+
+optimize() {
+ svgo -i $1 -o $1 --config svgo.config.mjs
+}
+
+for svg in ./**/*.svg; do
+ optimize $svg &;
+done;
+wait;
diff --git a/contrib/svgo.config.mjs b/contrib/svgo.config.mjs
@@ -0,0 +1,8 @@
+export default {
+ multipass: true, // boolean
+ datauri: 'unenc', // 'base64'|'enc'|'unenc'
+ plugins: [
+ 'preset-default', // built-in plugins enabled by default
+ 'prefixIds', // enable built-in plugins by name
+ ],
+};
+\ No newline at end of file