Added pre-commit and ignored .png files in gitignore

This commit is contained in:
Roger Gonzalez 2023-01-10 14:45:33 -03:00
parent 34ab0d0c4d
commit 5c50574502
Signed by: rogs
GPG Key ID: C7ECE9C6C36EC2E6
2 changed files with 7 additions and 1 deletions

2
.gitignore vendored
View File

@ -17,4 +17,4 @@ hugo.linux
# Temporary lock file while building
/.hugo_build.lock
*.png
*.webp

6
pre-commit Executable file
View File

@ -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' {} \;