build_demo_web.sh: fix opening link on windows and linux
Co-authored with @DrOptix with code from https://github.com/emilk/egui/pull/246
This commit is contained in:
parent
3803d0f3d1
commit
49ef94d322
1 changed files with 12 additions and 3 deletions
|
@ -29,12 +29,21 @@ TARGET_NAME="${CRATE_NAME}.wasm"
|
|||
wasm-bindgen "target/wasm32-unknown-unknown/$BUILD/$TARGET_NAME" \
|
||||
--out-dir docs --no-modules --no-typescript
|
||||
|
||||
# brew install wabt # to get wasm-strip
|
||||
# to get wasm-strip: apt/brew/dnf install wabt
|
||||
# wasm-strip docs/${CRATE_NAME}_bg.wasm
|
||||
|
||||
echo "Optimizing wasm…"
|
||||
# brew install binaryen # to get wasm-opt
|
||||
# to get wasm-opt: apt/brew/dnf install binaryen
|
||||
wasm-opt docs/egui_demo_app_bg.wasm -O2 --fast-math -o docs/egui_demo_app_bg.wasm # add -g to get debug symbols
|
||||
echo "Finished docs/${CRATE_NAME}_bg.wasm"
|
||||
|
||||
open http://localhost:8888/index.html
|
||||
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
||||
# Linux, ex: Fedora
|
||||
xdg-open http://localhost:8888/index.html
|
||||
elif [[ "$OSTYPE" == "msys" ]]; then
|
||||
# Windows
|
||||
start http://localhost:8888/index.html
|
||||
else
|
||||
# Darwin/MacOS, or something else
|
||||
open http://localhost:8888/index.html
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue