trunk-rs / trunk

Build, bundle & ship your Rust WASM application to the web.
https://trunkrs.dev/
Apache License 2.0
3.54k stars 255 forks source link

Tailwindcss doesn't load in prod. #897

Open RedIsGaming opened 3 weeks ago

RedIsGaming commented 3 weeks ago

When developing in dev mode with Leptos and tailwindcss, using the right settings and link attributes works, but when shipping it to prod, it doesn't load. The problem is in the dist folder the type is unknown. It doesn't know from which type is it: text/css, so it doesn't parse. The solution is to create in the index.html a href to a custom created tailwind.css from the tailwind attributes the 3 also listed on the website and put it in dist. As long as the path in dist match the path from the css there it doesn't matter if in main the index.html path doesn't work, because you can safely rely on data-trunk for it.

Its just something I got fixed this way. Hopefully you can fix it for features releases!

ctron commented 3 weeks ago

I am not sure I understand. Is there a simple reproducer? With some expected vs actual index.html that you could provide.

RedIsGaming commented 2 weeks ago

With npx you can put the input to the dist folder and compile that. Then you call in index.html the link to this, but trunk doesn't do this

ctron commented 2 weeks ago

The dist folder should only contain the build output. There's an intermediate build folder. But I understand too little about it to be able to help.

Maybe it makes sense to create a reproducer, as an example in trunk, showing how it works, and figuring out what needs to be done. A PR might help.