trunk.io
TLDR
Initialize trunk in a repository
Run all applicable linters and formatters on changed files
Run linters and formatters on specific files
Format files in place
List all available tools and their status
Enable a tool at a specific version
Print an action's execution history
SYNOPSIS
trunk <SUBCOMMAND> [<OPTIONS>] [<index.html>]
PARAMETERS
new <PROJECT_NAME>
Scaffold a new Trunk project with template
build [<index.html>]
Build project for production or release
serve [<index.html>]
Start development server with hot reload
clean
Remove build artifacts and dist directory
-d, --dist <DIR>
Output directory for builds (default: dist)
-r, --release
Build in release mode (optimized)
-p, --port <PORT>
Port for serve (default: 8080)
--open
Automatically open browser on serve
--config <PATH>
Path to Trunk.toml config
-h, --help
Show help for command
--version
Print version information
DESCRIPTION
Trunk is a multi-purpose tool designed for developing, building, and deploying WebAssembly web applications written in Rust. It acts as a build tool, asset bundler, and development server, simplifying workflows for Rust frontend frameworks like Yew, Leptos, Dioxus, or Percy. Trunk automatically handles bundling of Rust code compiled to WASM, CSS, images, fonts, and other static assets into an optimized production bundle.
During development, trunk serve provides a local server with hot reloading, file watching, and live updates. For production, trunk build generates a dist directory with minified assets, tree-shaken dependencies, and SRI hashes for security. Configuration is managed via Trunk.toml, allowing customization of preprocessors, plugins, and build settings. Trunk integrates seamlessly with Cargo, leveraging it for Rust compilation while extending capabilities for web targets.
Installation is via Cargo: cargo install trunk. It's lightweight, fast, and focuses on developer experience without requiring Node.js or npm.
CAVEATS
Requires Rust and Cargo installed; WASM target must be added via rustup target add wasm32-unknown-unknown. Not a core Linux utility—user-installed via Cargo. Config file Trunk.toml required for advanced use.
INSTALLATION
Run cargo install trunk after installing Rustup and adding WASM target.
CONFIGURATION
Uses Trunk.toml for [build], [serve], [files], and [plugins] sections to customize assets and processing.
HISTORY
Developed by Andrew Stalcup starting in 2020 as an open-source project under Apache-2.0/MIT licenses. Gained popularity with Rust WASM ecosystem growth; current version ~0.17 (2024), with ongoing enhancements for plugin system and framework support.


