docs icon indicating copy to clipboard operation
docs copied to clipboard

Hot reloading - state of the project

Open landsman opened this issue 2 years ago • 6 comments

Hello, I tried to search "hot reload" via search on website, in GitHub organisation, issues etc. What I found is a few questions about that as well.

  • https://github.com/vapor/vapor/issues/389
  • https://github.com/vapor/vapor/issues/311
  • https://github.com/vapor/vapor/issues/212
  • https://github.com/vapor/vapor/issues/181

So what is the state? Does it working, or should, is it present? From what I tried I didn't noticed.

Can you please consider to create a new page, at least under Leaf tab and describe the current situation of Hot reload feature It's fine to say that's not supported at the moment and contribution is welcome, or provide a few links to workarounds, unofficial solutions.

I believe that this is a quite common thing that every new developer looking for and there is no answer.

landsman avatar Jul 05 '23 10:07 landsman

You can disable leaf template caching with app.leaf.cache.isEnabled = false, but yeah it makes sense for it to be in the docs

ptoffy avatar Jul 05 '23 11:07 ptoffy

The cache is mentioned here but I'm happy to accept a PR to refine it. You still need to reload the page to see the changes.

There's also a PoC extension for Vapor that includes live previews of templates - https://github.com/HanneVerstraete/vapor-extension

0xTim avatar Jul 05 '23 12:07 0xTim

Using https://github.com/cespare/reflex, you can trigger the swift run command whenever the files under a certain directory change like so:

reflex -r 'Sources\/.*\.swift$' -R '\.build' -s swift run

Although I haven't tried it with a large project where the builds take some time.

kublaios avatar May 24 '24 13:05 kublaios