This is a template for use with the Leptos web framework using the Trunk tool to compile and serve your app in development.
This template requires you to have cargo-generate and trunk installed. leptosfmt is optional but highly recommended. You can install them with
cargo install cargo-generate trunk leptosfmtTo set up your project with this template, run
cargo generate --git https://github.com/leptos-rs/start-trunkto generate your new project, then
cd {{project-name}}to go to your newly created project.
By default, this template uses Rust nightly and requires that you've installed the wasm compilation target for your toolchain.
Sass and Tailwind are also supported by the Trunk build tool, but are optional additions: see here for more info on how to set those up with Trunk.
If you don't have Rust nightly, you can install it with
rustup toolchain install nightly --allow-downgradeYou can add the wasm compilation target to rust using
rustup target add wasm32-unknown-unknownTo develop your Leptos CSR project, running
trunk serve --port 3000 --openwill open your app in your default browser at http://localhost:3000.
To build a Leptos CSR app for release, use the command
trunk build --releaseThis will output the files necessary to run your app into the dist folder; you can then use any static site host to serve these files.
For further information about hosting Leptos CSR apps, please refer to the Leptos Book chapter on deployment available here.