casid / jte

Secure and speedy templates for Java and Kotlin.
https://jte.gg
Apache License 2.0
844 stars 63 forks source link

LiveReload with Spring #399

Closed tschuehly closed 3 weeks ago

tschuehly commented 3 weeks ago

Spring Boot automatically starts a livereload server that can be connected with:

<script src="http://localhost:35729/livereload.js"></script>

But to trigger a live reload, Spring needs to be notified that a template has changed.

This is done with a FileSystemWatcher. I've created a PR: https://github.com/casid/jte/pull/398

casid commented 3 weeks ago

Thanks for the PR @tschuehly!

Does the ContextRefreshedEvent lead to a restart of the application, or does it only trigger a browser reload?

Changing jte templates doesn't require an application restart, so it would be nice if only the browser would reload.

tschuehly commented 3 weeks ago

@casid It only triggers a browser reload.

casid commented 3 weeks ago

That's awesome then! I've just merged the PR. Thanks for the clarification!

frederikb commented 2 weeks ago

If it's not too much trouble we would be glad to have a bugfix release containing this change.

casid commented 2 weeks ago

Hi @frederikb, not at all!

I'll create a new release tomorrow :-)

casid commented 2 weeks ago

@frederikb 3.1.14 is out, containing this feature.

frederikb commented 2 weeks ago

Thanks a lot, @casid, that was much faster than expected! And thanks @tschuehly, my first try was successful.

I'll test drive it for a bit and would report back if anything pops-up. Happy weekend.