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

Auto reload for get new changes! #292

Closed
bekhzod91 opened this issue May 17, 2017 · 10 comments
Closed

Auto reload for get new changes! #292

bekhzod91 opened this issue May 17, 2017 · 10 comments
Labels
declined A declined request or suggestion request Request for new functionality

Comments

@bekhzod91
Copy link

Auto reload server when change source code for get new changes in development mode. What are you think about it?

@Qqwy
Copy link

Qqwy commented May 17, 2017

Live reloading is a wonderful feature. However, supporting it in a compiled language is rather difficult.

There is some work done in making it possible to do dynamic loading in Rust, but again, this kind of thing is very difficult in a compiled system, and therefore the current state of this is not mature enough to include in Rocket, I think. more information.

@blackghost1987
Copy link
Contributor

So Auto Reload in case of source code changes is probably not viable right now, but what about reloading the templates automatically? Is it possible somehow for Tera templates for example?

@Eijebong
Copy link
Contributor

See #163 regarding the templates reloading

@SergioBenitez
Copy link
Member

I think something like per-route live reloading would be absolutely incredible, but given the complexities involved and the nature of Rust, is unlikely to ever happen. Nonetheless, incremental compilation is actively being worked on by the Rust team, so simply recompiling and restarting should eventually be plenty fast. Coupled with something like watchexec as mentioned in #163, and you'll have something very close to "auto reload".

For templating specifically, I think it would be nice if Rocket could reload templates automatically during development. Further, I think it's absolutely possible, and quite simple, in fact, given the new fairings and the new Template implementation in master. We should see this in the not-too-distant future. We can have that discussion in #163.

@SergioBenitez SergioBenitez added declined A declined request or suggestion request Request for new functionality labels May 19, 2017
@shurik
Copy link

shurik commented Aug 5, 2020

Hello, in case anyone comes across this issue like I did, there's a pretty simple, "Unixy" workaround that will reload the development server whenever a file changes:

fd -g "*.rs" | entr -r cargo run

@kotovalexarian
Copy link

For me the following shell code works: find src -type f | entr -r cargo run

@sondnm
Copy link

sondnm commented Nov 19, 2020

I use cargo-watch cargo watch -x run.

@SergioBenitez
Copy link
Member

For posterity, note that since this issue, Rocket has gained the ability to automatically live-reload templates. This is enabled by default when the application is compiled in debug mode. There is no need to use external tools if the desire is to see changes to templates as they happen. If code changes occur elsewhere, however, the suggestion to use tools like cargo-watch and watchexec remain valid.

@Away0x
Copy link

Away0x commented Aug 3, 2021

I use cargo-make

# Makefile.toml

# cargo make watch
[tasks.watch]
command = "cargo"
args = ["run"]
watch = true

@hadpro24
Copy link

I use cargo-watch cargo watch -x run.

Thanks you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
declined A declined request or suggestion request Request for new functionality
Projects
None yet
Development

No branches or pull requests

10 participants