Skip to content

Instantly share code, notes, and snippets.

@lightdiscord
Last active July 5, 2021 15:20
Show Gist options
  • Save lightdiscord/9ee47c760be963604a7fcac4a7dd0f94 to your computer and use it in GitHub Desktop.
Save lightdiscord/9ee47c760be963604a7fcac4a7dd0f94 to your computer and use it in GitHub Desktop.
Rust and wasm and netlify

Rust, wasm and Netlify.

🦀 + 🕸 + 🖼 = 💖


Instructions

$ curl https://git.io/fxm5j -sSLf | bash
#!/usr/bin/env bash
set -e
cweb_version=0.6.16
cweb=https://github.com/koute/cargo-web/releases/download/$cweb_version/cargo-web-x86_64-unknown-linux-gnu.gz
curl -Lo cargo-web.gz $cweb
gunzip cargo-web.gz
chmod u+x cargo-web
binaryen_version=version_51
binaryen=https://github.com/WebAssembly/binaryen/releases/download/$binaryen_version/binaryen-$binaryen_version-x86_64-linux.tar.gz
curl -Lo binaryen.tar.gz $binaryen
tar -xzf binaryen.tar.gz
curl https://sh.rustup.rs -sSf | sh -s - --default-toolchain nightly -y
source ~/.cargo/env
rustup target add wasm32-unknown-unknown
./cargo-web deploy --target=wasm32-unknown-unknown --release
shopt -s nullglob
for filename in ./target/deploy/*.wasm
do
./binaryen-$binaryen_version/wasm-opt -Oz -d -o $filename $filename 2> /dev/null
done
@andrrff
Copy link

andrrff commented Dec 13, 2020

How do I deploy to a yew, which uses trunk? * i don't speak english if you have any mistake forgive me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment