百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
Y

yew-trunk-minimal-template

> 编程语言
开源

使用 Trunk 启动 Yew 项目的模板

100 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

使用 Trunk 启动 Yew 项目的模板

Yew Trunk Template

This is a fairly minimal template for a Yew app that's built with Trunk.

Usage

For a more thorough explanation of Trunk and its features, please head over to the repository.

Installation

If you don't already have it installed, it's time to install Rust: . The rest of this guide assumes a typical Rust installation which contains both rustup and Cargo.

To compile Rust to WASM, we need to have the wasm32-unknown-unknown target installed. If you don't already have it, install it with the following command:

bash
rustup target add wasm32-unknown-unknown

Now that we have our basics covered, it's time to install the star of the show: Trunk. Simply run the following command to install it:

bash
cargo install trunk wasm-bindgen-cli

That's it, we're done!

Running

bash
trunk serve

Rebuilds the app whenever a change is detected and runs a local server to host it.

There's also the trunk watch command which does the same thing but without hosting it.

Release

bash
trunk build --release

This builds the app in release mode similar to cargo build --release. You can also pass the --release flag to trunk serve if you need to get every last drop of performance.

Unless overwritten, the output will be located in the dist directory.

Using this template

There are a few things you have to adjust when adopting this template.

Remove example code

The code in src/main.rs specific to the example is limited to only the view method. There is, however, a fair bit of Sass in index.scss you can remove.

Update metadata

Update the name, version, description and repository fields in the Cargo.toml file. The index.html file also contains a `` tag that needs updating.

If you cloned this repo without using cargo generate, you can safely remove the cargo-generate directory.

Finally, you should update this very README file to be about your app.

License

The template ships with both the Apache and MIT license. If you don't want to have your app dual licensed, just remove one (or both) of the files and update the license field in Cargo.toml.

There are two empty spaces in the MIT license you need to fill out: {{year}} and {{authors}}.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Rust

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言