Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trunk serve doesn't update template changes #30

Open
Hessesian opened this issue Aug 21, 2023 · 3 comments
Open

Trunk serve doesn't update template changes #30

Hessesian opened this issue Aug 21, 2023 · 3 comments

Comments

@Hessesian
Copy link

If I modify css/elements in template, the generated template is not reloaded with trunk serve watcher.
Fix is to call cargo clean and then trunk serve to see changes.
If you would point me into work that has to be done I could try to fix it, thanks

@MarcAntoine-Arnaud
Copy link

Hello,
You can use the trunk option (trunk watch -w folder) as mentioned in the documentation (trunk watch --help):

    -w, --watch <path>               Watch specific file(s) or folder(s) [default: build target parent folder]

@Hessesian
Copy link
Author

Hi, I did try that (for example trunk serve -w src/templates/MainScreen.html ) but after changing text it still doesn't reload the website, furthermore not even when I cancel trunk serve and start it again, it needs that cargo clean command, which leads me to believe of some mysterious cache somewhere ?

@nanobot248
Copy link

nanobot248 commented Jul 17, 2024

I just encountered the same problem. I think this is related to the fact that the rust file you are unsing the template_html! macro in doesn't change. And rustc has no way of knowing that the HTML file is part of the Rust source code and therefore the source file that uses template_html!(...) is considered unchanged.
There is a pre-RFC for that topic: https://internals.rust-lang.org/t/pre-rfc-add-a-builtin-macro-to-indicate-build-dependency-to-file/9242

A workaround would be to use include_str! or include_bytes!, but then the generated binary would contain unused data.

I guess you could also work around it via a build.rs file, but i haven't really thought that through yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants