cargo install --locked trunk cargo install wasm-bindgen-cli
Check out “Build a sample app” for a short guide on how to build Yew apps with Trunk.
You can also see it in action by looking at our examples, all of which are built with Trunk.
Trunk builds your app based on the
index.html file which serves as a config file of sorts.
wasm-pack, this tool is actually designed to build apps.
This means you don’t need to add
cdylib as a library target and you can use the
as an entry point.
To build a simple Yew app you just need an
index.html file at the root of your project:
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>Yew App</title> </head> </html>
The Trunk CLI provides several useful commands but during development
trunk serve is certainly the most useful one.
It runs a local server for you and automatically rebuilds the app when it detects changes.
When you’re ready to release your app, you can just run
trunk build --release.
This summary here doesn’t nearly cover all of Trunk’s features, be sure to check out the README!