Browse Source

Add Makefile and use GNU parallel in compress.sh

master
BBaoVanC 2 months ago
parent
commit
2240b34564
Signed by: bbaovanc GPG Key ID: 18089E4E3CCF1D3A
  1. 8
      Makefile
  2. 23
      compress.sh

8
Makefile

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

23
compress.sh

@ -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
Loading…
Cancel
Save