summaryrefslogtreecommitdiff
path: root/pre-commit
diff options
context:
space:
mode:
authorRoger Gonzalez <roger@rogs.me>2023-01-10 14:45:33 -0300
committerRoger Gonzalez <roger@rogs.me>2023-01-10 14:45:33 -0300
commit5c50574502b097f6f5a60ec3f0588e1871270ae5 (patch)
treed1ac8e877777e5eed1b99d2448961bae30a9c4c6 /pre-commit
parent34ab0d0c4de8785955526c8d091835cbce0e7cb3 (diff)
Added pre-commit and ignored .png files in gitignore
Diffstat (limited to 'pre-commit')
-rwxr-xr-xpre-commit6
1 files changed, 6 insertions, 0 deletions
diff --git a/pre-commit b/pre-commit
new file mode 100755
index 0000000..b2a2042
--- /dev/null
+++ b/pre-commit
@@ -0,0 +1,6 @@
+#!/bin/sh
+#
+set -eo pipefail
+
+find ./ -type f -name '*.png' -not -path '*/.git/*' -exec sh -c 'cwebp $1 -o "${1%.png}.webp"' _ {} \;
+find . -type f -not -path '*/.git/*' -exec sed -i -e 's/\.png/\.webp/g' {} \;