trunk
trunk copied to clipboard
Example html on the website is wrong
The website states
let's get started with the following example. Copy this HTML to the root of your project's repo as index.html:
<html> <head> <link data-trunk rel="scss" href="path/to/index.scss"/> </head> </html>
But when I paste that, trunk build errors with
2025-03-16T18:01:57.827277Z INFO 🚀 Starting trunk 0.21.9
2025-03-16T18:02:02.264979Z INFO 📦 starting build
2025-03-16T18:02:02.270398Z ERROR ❌ error
error from build pipeline
Caused by:
0: error getting canonical path for "/home/generic/projects/games/glide/hexgridspiral-example/path/to/index.scss"
1: No such file or directory (os error 2)
2025-03-16T18:02:02.270603Z ERROR error from build pipeline
2025-03-16T18:02:02.271518Z INFO 1: error getting canonical path for "/home/generic/projects/games/glide/hexgridspiral-example/path/to/index.scss"
2025-03-16T18:02:02.271523Z INFO 2: No such file or directory (os error 2)
When I create an empty index.scss and point to that, this error is fixed, but another occurs:
2025-03-16T18:02:50.563698Z INFO 🚀 Starting trunk 0.21.9
2025-03-16T18:02:50.796192Z INFO 📦 starting build
2025-03-16T18:02:51.034710Z INFO downloading sass version="1.69.5"
Compiling hexgridspiral-example v0.1.0 (/home/generic/projects/games/glide/hexgridspiral-example)
2025-03-16T18:02:52.183223Z INFO installing sass hexgridspiral-example(bin)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 3.16s
2025-03-16T18:02:54.408835Z INFO downloading wasm-bindgen version="0.2.100"
2025-03-16T18:02:55.928989Z INFO installing wasm-bindgen
2025-03-16T18:03:06.036294Z ERROR ❌ error
error from build pipeline
Caused by:
0: HTML build pipeline failed (1 errors), showing first
1: failed to finalize asset pipeline
2: Document has neither a <link data-trunk rel="rust"/> nor a <body>. Either one must be present.
2025-03-16T18:03:06.036579Z ERROR error from build pipeline
2025-03-16T18:03:06.036586Z INFO 1: HTML build pipeline failed (1 errors), showing first
2025-03-16T18:03:06.036590Z INFO 2: failed to finalize asset pipeline
2025-03-16T18:03:06.036594Z INFO 3: Document has neither a <link data-trunk rel="rust"/> nor a <body>. Either one must be present.
When I then add the suggested line, the build completes. But I don't really have any idea whether my fixes were correct / intended.
This is my "fixed" html:
<!--
trunk build will fill this up with our wasm build and place it at dist/index.html
https://trunkrs.dev/
-->
<html>
<head>
<link data-trunk rel="scss" href="index.scss"/>
<link data-trunk rel="rust"/>
</head>
</html>
Could you create a PR for this?
I guess I can, yes. If "it ended up working" is enough of a guarantee that the html I used is actually correct as intended?
Made a PR. Unclear to me whether merging to main or gh-pages is what it should be. I only noticed the gh-pages branch now. But if gh-pages is used for hosting the page, then why is the same index example in the main folder structure too?
Sorry for the confusion. Lmk what I should change (or if you prefer just do it yourself)