leptos-rs / cargo-leptos

Build tool for Leptos (Rust)
MIT License
314 stars 87 forks source link

`hash-files` breaks tailwind hot reloading #271

Open johnbchron opened 1 month ago

johnbchron commented 1 month ago

Hey there! Thanks for adding the hash-files option; it's really helpful.

I have hash-files and tailwind enabled. When I change my code to add a new tailwind class, it kicks off the rust build and the tailwind build as expected, but when the page reloads I don't get the new styles. I suspect that this is because the hashes don't get properly updated for the CSS when tailwind rebuilds.

Right now I have to restart cargo leptos watch for the target/debug/hash.txt file to change, and also for the CSS link in the HTML head to change. Following the restart, I have the new classes.

I apologize that I don't have enough time for a reproduction right now, but to reproduce it should only require that hash-files and tailwind are enabled.

EDIT: actually I do have a reproduction, it's just not minimal :)

johnbchron commented 6 days ago

Any thoughts on this? If there's not bandwidth to look at this, let me know and I can spend some time on it.

gbj commented 5 days ago

Generally with cargo-leptos the answer is going to be that there's not bandwidth to look at this, so definitely feel free to investigate.

johnbchron commented 13 hours ago

For others seeing this, my workaround is to turn hash-files off in the Cargo.toml and then add LEPTOS_HASH_FILES=true during the release build.

I'm still planning to investigate the root cause when I have some time.