Fix posthook to work no matter what the structure of assets

This commit is contained in:
James Mills 2023-03-30 20:23:00 +10:00
parent 9be5115b6b
commit 303eebf94b
No known key found for this signature in database
GPG Key ID: AC4C014F1440EBD6

View File

@ -2,13 +2,16 @@
set -e set -e
CSS="bahunya site" minify_assets() {
JS="live" p="$1"
t="$2"
for css in $CSS; do find "$p" -type f -name "*.$t" | while read -r file; do
minify -o "$ZS_OUTDIR/css/$css.min.css" "$ZS_OUTDIR/css/$css.css" name="${file#"$p"}"
done name="${name#"/"}"
minify -o "${p}/${name}" "$file"
done
}
for js in $JS; do minify_assets "$ZS_OUTDIR" "css"
minify -o "$ZS_OUTDIR/js/$js.min.js" "$ZS_OUTDIR/js/$js.js" minify_assets "$ZS_OUTDIR" "js"
done