Add precompression step to frontend

This commit is contained in:
2024-12-22 01:43:36 -06:00
parent 101ffe3172
commit d7d3b83007
3 changed files with 21 additions and 48 deletions

20
frontend/compress.sh Executable file
View File

@@ -0,0 +1,20 @@
#!/bin/bash
multicompress() {
local file="$1"
if command -v gzip &>/dev/null; then
gzip --best --stdout --keep "$file" >"$file.gz"
fi
if command -v zstd &>/dev/null; then
zstd --keep --force -19 --quiet "$file" -o "$file.zst"
fi
if command -v brotli &>/dev/null; then
brotli --best --force -o "$file.br" "$file"
fi
}
export -f multicompress
# create pre-compressed variants gzip, zstd, brotli for dist files
find ./dist/ -type f ! -name '*.gz' ! -name '*.br' ! -name '*.zst' -exec bash -c 'multicompress "$0"' {} \;