Skip to content

Build, bundle & ship your Rust WASM application to the web.

Compare
Choose a tag to compare
@thedodd thedodd released this 26 Aug 03:39

I am happy to announce the very first release of Trunk. Trunk is a CLI tool, written in Rust, which provides a simple, zero-config pattern for building Rust WebAssembly applications, bundling application assets (sass, css, images &c) and shipping it all to the web.

Trunk is designed for creating progressive, single-page web applications, written in Rust, compiled to WebAssembly, without any JS (though today JS is still needed for loading WASM modules). Trunk follows a simple paradigm: declare an index.html file describing the single page of your application, then Trunk will parallelize bundling assets declared in your HTML, will build your WASM app, hash resources for cache control ... all without any extra config files.

Getting Started

Getting up and running with Trunk couldn't be easier. Head on over to the Getting Started section of the README for more details.

Features

Trunk ships with a built-in sass/scss compiler, a web server for serving your content during development, responds to file system changes while you work to trigger builds, and has other features already available and many others in the works. Check out the readme for more details.

Future

Trunk was born out of necessity. Personally, I have been SO eager to be able to build web applications entirely in Rust. The stability of Rust language overall, the ability to refactor and move quickly, the ability to scale out a code base with confidence ... a night and day difference from building non-trivial JS/TS web applications. I realized many times over that last few years that this is exactly the sort of tool we needed in the Rust WASM community to really help with ease and speed of development, and the lack of a tool like this was a major roadblock for me multiple times. I sincerely hope that Trunk will help us all forward on this path.

After some discussion with folks in the community, I would love to be able to leverage wasm-pack in the Trunk build pipeline. At a minimum for managing wasm-bindgen versions/installation, but perhaps to a further extent as well (see #5).

There are lots of other features in the works. SSE from the server to trigger reloads. WASM HMR (faster than reloads, but probably a bigger effort). Support for more asset types, minification, etc, etc. Lots to do.

Though this project is just a baby, it is usable right now, and I am currently using it for a personal project. I hope you find the time to use it, and if you do, please take the time to report your findings. What worked for you? What are some things which you still need? Any and all feedback is appreciated. Let's do this!

”Pack your things, we’re going on an adventure!” ~ Ferris