Add Makefile and use GNU parallel in compress.sh

This commit is contained in:
BBaoVanC 2021-06-12 20:31:14 -05:00
parent e3716c6333
commit 2240b34564
Signed by: bbaovanc
GPG Key ID: 18089E4E3CCF1D3A
2 changed files with 20 additions and 11 deletions

8
Makefile Normal file
View File

@ -0,0 +1,8 @@
all: public
clean:
rm -rf public/
public:
hugo
./compress.sh

View File

@ -2,17 +2,18 @@
files=$(find public/ -name "*.html" -o -name "*.xml" -o -name "*.css" -o -name "*.js")
for f in $files; do
( gzip -fnk "$f" && echo "GZIP $f" ) &
done
gz() {
echo "GZIP $1"
gzip -fnk $1
}
wait
echo "gzip done, starting brotli"
br() {
echo "BROTLI $1"
brotli -fZk $1
}
export -f gz
export -f br
for f in $files; do
( brotli -fZk "$f" && echo "BROTLI $f" ) &
done
wait
echo "broli done"
parallel $@ gz {} <<< $files
parallel $@ br {} <<< $files