From 317dd32952f7e7cfc558fea69b1a61691710a77f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Wed, 26 Nov 2025 22:03:53 +0200 Subject: [PATCH] more robust compression --- scripts/Makefile.static | 17 +++++++++++++++++ scripts/build | 11 +---------- 2 files changed, 18 insertions(+), 10 deletions(-) create mode 100644 scripts/Makefile.static diff --git a/scripts/Makefile.static b/scripts/Makefile.static new file mode 100644 index 0000000..5f21944 --- /dev/null +++ b/scripts/Makefile.static @@ -0,0 +1,17 @@ +SRCS = $(wildcard *.html *.xml *.txt *.css *.map *.pdf) + +ZSTD = $(patsubst %,%.zst,$(SRCS)) +BR = $(patsubst %,%.br,$(SRCS)) +GZ = $(patsubst %,%.gz,$(SRCS)) + +.PHONY: all +all: $(ZSTD) $(BR) $(GZ) + +%.br: % + brotli $< + +%.zst: % + zstd -19 $< + +%.gz: % + zopfli $< diff --git a/scripts/build b/scripts/build index 4efb896..b554ec6 100755 --- a/scripts/build +++ b/scripts/build @@ -4,13 +4,4 @@ cd "$(git rev-parse --show-toplevel)" hugo --cleanDestinationDir --printPathWarnings --panicOnWarning -find public \ - -name '*.html' -or \ - -name '*.xml' -or \ - -name '*.txt' -or \ - -name '*.css' -or \ - -name '*.map' -or \ - -name '*.pdf' | \ - tee >(xargs -n1 -P$(nproc) zopfli) | \ - tee >(xargs -n1 -P$(nproc) zstd -19) | \ - xargs -n1 -P$(nproc) brotli +find public -type d | xargs -P4 -n1 make -j4 -sf $PWD/scripts/Makefile.static -C