diff --git a/.gitignore b/.gitignore index f636cdc0ca6..97aa9b7108f 100644 --- a/.gitignore +++ b/.gitignore @@ -49,6 +49,8 @@ Thumbs.db *.wasm /wasm_exec.js docs/public/wasm/gh-aw.wasm +docs/public/wasm/gh-aw.wasm.br +docs/public/wasm/gh-aw.wasm.gz docs/public/wasm/wasm_exec.js # Go binary for this project diff --git a/docs/public/editor/index.html b/docs/public/editor/index.html index b9c208404e9..1141950d39d 100644 --- a/docs/public/editor/index.html +++ b/docs/public/editor/index.html @@ -130,7 +130,7 @@
diff --git a/scripts/bundle-wasm-docs.sh b/scripts/bundle-wasm-docs.sh index ddb74f7959f..466b22b0117 100755 --- a/scripts/bundle-wasm-docs.sh +++ b/scripts/bundle-wasm-docs.sh @@ -35,6 +35,19 @@ if [ ! -f "${WASM_EXEC_SRC}" ]; then fi cp "${WASM_EXEC_SRC}" "${DEST_DIR}/wasm_exec.js" +# Generate brotli-compressed version for smaller transfers +# GitHub Pages serves .br files automatically when Accept-Encoding: br is present +if command -v brotli &> /dev/null; then + echo "==> Compressing WASM with brotli..." + brotli -k -q 11 "${DEST_DIR}/gh-aw.wasm" + echo "Compressed: $(du -h "${DEST_DIR}/gh-aw.wasm.br" | cut -f1) (from $(du -h "${DEST_DIR}/gh-aw.wasm" | cut -f1))" +else + echo "Warning: brotli not found. Install with: apt-get install brotli (or brew install brotli)" + echo "Falling back to gzip compression..." + gzip -k -9 "${DEST_DIR}/gh-aw.wasm" + echo "Compressed: $(du -h "${DEST_DIR}/gh-aw.wasm.gz" | cut -f1) (from $(du -h "${DEST_DIR}/gh-aw.wasm" | cut -f1))" +fi + echo "" echo "Done. Files in ${DEST_DIR}:" ls -lh "${DEST_DIR}/gh-aw.wasm" "${DEST_DIR}/wasm_exec.js"