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

Add hot reload for tera templates #920

Closed
Swoorup opened this issue Oct 27, 2024 · 2 comments
Closed

Add hot reload for tera templates #920

Swoorup opened this issue Oct 27, 2024 · 2 comments
Labels
enhancement New feature or request
Milestone

Comments

@Swoorup
Copy link
Contributor

Swoorup commented Oct 27, 2024

Feature Request

Can we add hot reload mechanism for tera templates.

Is your feature request related to a problem? Please describe.

N/a

Describe the solution you'd like

Editing tera .html files should result in immediate changes without compiling source. See also https://www.reddit.com/r/rust/comments/1f2rbe7/livereload_using_tera_in_axum

Describe alternatives you've considered

N/A

@Swoorup Swoorup added the enhancement New feature or request label Oct 27, 2024
@jondot
Copy link
Contributor

jondot commented Oct 28, 2024

Thanks for the feedback!
We actually experimented with this (see https://github.com/loco-rs/loco/blob/master/src/controller/views/engines.rs#L57)
Then we commented it out because it meant having unsafe code in Loco.

We want to bring it back, but only if we can make sure that it's only enabled in Debug builds, and no unsafe code in the Loco framework.

Right now we're recommending cargo-watch until we can find a good idea to accomplish the above.


One solution we can provide is that in debug mode only, or in configuration use fs to read a file (by key) and render from string directly.
Let's experiment with that for 0.13.0

@jondot jondot added this to the 0.13.0 milestone Oct 28, 2024
@jondot
Copy link
Contributor

jondot commented Nov 10, 2024

I've implemented #977 as the simplest way to achieve a reload effect.
let's take your #930 and turn it into a live-reload only integration, if you can shape it in a form of a middleware that would be the best option for us 👍
closing this one

@jondot jondot closed this as completed Nov 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants