mirror of
https://git.mills.io/prologic/zs-starter-template.git
synced 2024-11-23 05:46:04 +03:00
Fix posthook to work no matter what the structure of assets
This commit is contained in:
parent
9be5115b6b
commit
303eebf94b
19
.zs/posthook
19
.zs/posthook
@ -2,13 +2,16 @@
|
||||
|
||||
set -e
|
||||
|
||||
CSS="bahunya site"
|
||||
JS="live"
|
||||
minify_assets() {
|
||||
p="$1"
|
||||
t="$2"
|
||||
|
||||
for css in $CSS; do
|
||||
minify -o "$ZS_OUTDIR/css/$css.min.css" "$ZS_OUTDIR/css/$css.css"
|
||||
done
|
||||
find "$p" -type f -name "*.$t" | while read -r file; do
|
||||
name="${file#"$p"}"
|
||||
name="${name#"/"}"
|
||||
minify -o "${p}/${name}" "$file"
|
||||
done
|
||||
}
|
||||
|
||||
for js in $JS; do
|
||||
minify -o "$ZS_OUTDIR/js/$js.min.js" "$ZS_OUTDIR/js/$js.js"
|
||||
done
|
||||
minify_assets "$ZS_OUTDIR" "css"
|
||||
minify_assets "$ZS_OUTDIR" "js"
|
||||
|
Loading…
Reference in New Issue
Block a user