summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rwxr-xr-xpre-commit6
2 files changed, 7 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
index 2a5d5cd..87f9c74 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,4 +17,4 @@ hugo.linux
# Temporary lock file while building
/.hugo_build.lock
-*.png
+*.webp
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' {} \;