Add Makefile and use GNU parallel in compress.sh
This commit is contained in:
parent
e3716c6333
commit
2240b34564
|
@ -0,0 +1,8 @@
|
||||||
|
all: public
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rf public/
|
||||||
|
|
||||||
|
public:
|
||||||
|
hugo
|
||||||
|
./compress.sh
|
23
compress.sh
23
compress.sh
|
@ -2,17 +2,18 @@
|
||||||
|
|
||||||
files=$(find public/ -name "*.html" -o -name "*.xml" -o -name "*.css" -o -name "*.js")
|
files=$(find public/ -name "*.html" -o -name "*.xml" -o -name "*.css" -o -name "*.js")
|
||||||
|
|
||||||
for f in $files; do
|
gz() {
|
||||||
( gzip -fnk "$f" && echo "GZIP $f" ) &
|
echo "GZIP $1"
|
||||||
done
|
gzip -fnk $1
|
||||||
|
}
|
||||||
|
|
||||||
wait
|
br() {
|
||||||
echo "gzip done, starting brotli"
|
echo "BROTLI $1"
|
||||||
|
brotli -fZk $1
|
||||||
|
}
|
||||||
|
|
||||||
|
export -f gz
|
||||||
|
export -f br
|
||||||
|
|
||||||
for f in $files; do
|
parallel $@ gz {} <<< $files
|
||||||
( brotli -fZk "$f" && echo "BROTLI $f" ) &
|
parallel $@ br {} <<< $files
|
||||||
done
|
|
||||||
|
|
||||||
wait
|
|
||||||
echo "broli done"
|
|
||||||
|
|
Loading…
Reference in New Issue