Last active
September 26, 2023 12:07
-
-
Save Calinou/30f21f07017d908fc74c7eccb3f469c3 to your computer and use it in GitHub Desktop.
Brotli precompression script for the Godot website. Apache configuration: https://gist.github.com/Calinou/fc0fe1003c95380054f0084f9476e476
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -euo pipefail | |
IFS=$'\n\t' | |
# Usage: Place the script in `htdocs/` and run `./static-precompress.sh themes/godotengine/assets`. | |
echo "Precompressing assets in \"$1\"..." | |
BROTLICOMMAND="$(readlink -f $(dirname "${BASH_SOURCE[0]}")/brotli)" | |
#BROTLICOMMAND=$(which brotli) | |
cd "$1" | |
if command -v "$BROTLICOMMAND"; then | |
echo "Found Brotli binary at \"$BROTLICOMMAND\"." | |
else | |
echo "ERROR: Couldn't find a Brotli binary." | |
exit 1 | |
fi | |
find ./ -type f \ | |
\( -iname \*.css -o -iname \*.ico -o -iname \*.js -o -iname \*.json -o -iname \*.svg \) \ | |
-exec $BROTLICOMMAND --keep --force --quality=11 {} \; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment