diff --git a/sh/build_demo_web.sh b/sh/build_demo_web.sh index 97cad254..3d5f693c 100755 --- a/sh/build_demo_web.sh +++ b/sh/build_demo_web.sh @@ -37,7 +37,7 @@ done export RUSTFLAGS=--cfg=web_sys_unstable_apis # Clear output from old stuff: -rm -f docs/${CRATE_NAME}_bg.wasm +rm -f "docs/${CRATE_NAME}_bg.wasm" echo "Building rust…" BUILD=release @@ -57,7 +57,7 @@ TARGET=`cargo metadata --format-version=1 | jq --raw-output .target_directory` echo "Generating JS bindings for wasm…" TARGET_NAME="${CRATE_NAME}.wasm" WASM_PATH="${TARGET}/wasm32-unknown-unknown/$BUILD/$TARGET_NAME" -wasm-bindgen ${WASM_PATH} --out-dir docs --no-modules --no-typescript +wasm-bindgen "${WASM_PATH}" --out-dir docs --no-modules --no-typescript # if this fails with "error: cannot import from modules (`env`) with `--no-modules`", you can use: # wasm2wat target/wasm32-unknown-unknown/release/egui_demo_app.wasm | rg env @@ -66,15 +66,15 @@ wasm-bindgen ${WASM_PATH} --out-dir docs --no-modules --no-typescript # to get wasm-strip: apt/brew/dnf install wabt # wasm-strip docs/${CRATE_NAME}_bg.wasm -if [ "${FAST}" = false ]; then +if [[ "${FAST}" = false ]]; then echo "Optimizing wasm…" # to get wasm-opt: apt/brew/dnf install binaryen - wasm-opt docs/${CRATE_NAME}_bg.wasm -O2 --fast-math -o docs/${CRATE_NAME}_bg.wasm # add -g to get debug symbols + wasm-opt "docs/${CRATE_NAME}_bg.wasm" -O2 --fast-math -o "docs/${CRATE_NAME}_bg.wasm" # add -g to get debug symbols fi echo "Finished docs/${CRATE_NAME}_bg.wasm" -if [ "${OPEN}" = true ]; then +if [[ "${OPEN}" == true ]]; then if [[ "$OSTYPE" == "linux-gnu"* ]]; then # Linux, ex: Fedora xdg-open http://localhost:8888/index.html