mirror of
https://github.com/Xevion/dynamic-preauth.git
synced 2025-12-06 15:14:59 -06:00
Add precompression step to frontend
This commit is contained in:
20
frontend/compress.sh
Executable file
20
frontend/compress.sh
Executable 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"' {} \;
|
||||
Reference in New Issue
Block a user