Skip to content

Commit 038e8bd

Browse files
ColumbusLabsctron
authored andcommitted
docs: document tools configuration
1 parent 6fea90a commit 038e8bd

1 file changed

Lines changed: 48 additions & 0 deletions

File tree

guide/src/configuration/index.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,54 @@ minify = "never" # Control minification: can be one of: never, on_rel
131131
no_sri = false # Allow disabling sub-resource integrity (SRI)
132132
```
133133

134+
## Tools section
135+
136+
Trunk can locate and, when necessary, download the external tools used by its
137+
asset and WebAssembly pipelines. The optional `[tools]` section pins the exact
138+
version of each tool:
139+
140+
```toml
141+
[tools]
142+
sass = "1.69.5" # dart-sass, used by sass and scss assets
143+
wasm_bindgen = "0.2.89" # wasm-bindgen CLI
144+
wasm_opt = "version_123" # Binaryen's wasm-opt, used for optimized release builds
145+
tailwindcss = "3.3.5" # Tailwind standalone CLI
146+
```
147+
148+
The values above are Trunk's default download versions. If a tool is already
149+
available on `PATH`, Trunk uses it without downloading another copy. When a
150+
version is configured, the system tool is used only if its detected version is
151+
an exact match; otherwise Trunk downloads and caches the requested version.
152+
With offline mode enabled, a missing or mismatched tool produces an error
153+
instead of a download.
154+
155+
`wasm_bindgen` has one additional version-selection step: when it is not
156+
configured, Trunk first tries to use the `wasm-bindgen` version from
157+
`Cargo.lock`, then from `Cargo.toml`, before falling back to the default above.
158+
159+
Each value can also be supplied as an environment variable or a CLI option to
160+
`trunk build`, `trunk watch`, and `trunk serve`:
161+
162+
| Configuration | Environment variable | CLI option |
163+
| --- | --- | --- |
164+
| `sass` | `TRUNK_TOOLS_SASS` | `--sass` |
165+
| `wasm_bindgen` | `TRUNK_TOOLS_WASM_BINDGEN` | `--wasm-bindgen` |
166+
| `wasm_opt` | `TRUNK_TOOLS_WASM_OPT` | `--wasm-opt` |
167+
| `tailwindcss` | `TRUNK_TOOLS_TAILWINDCSS` | `--tailwindcss` |
168+
169+
For example, to opt into Tailwind CSS 4:
170+
171+
```toml
172+
[tools]
173+
tailwindcss = "4.0.6"
174+
```
175+
176+
Tool versions can include breaking changes, so the project's source and
177+
configuration must be compatible with the selected version. The `tailwindcss`
178+
setting also selects the version for `rel="tailwind-css-extra"` assets; when it
179+
is not set, that pipeline uses its own default (`1.7.25`) rather than the
180+
Tailwind standalone CLI default shown above.
181+
134182
## Watch section
135183

136184
Trunk has built-in support for watching for source file changes, which triggers

0 commit comments

Comments
 (0)