-
Notifications
You must be signed in to change notification settings - Fork 40.8k
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 support for LiveReload without browser extensions #43697
base: main
Are you sure you want to change the base?
Conversation
This commit improves Dev Tools live reload capabilities by adding support for appending LiveReload.js script to rendered web pages. See spring-projectsgh-32111
*/ | ||
@Configuration(proxyBeanMethods = false) | ||
@ConditionalOnWebApplication(type = Type.SERVLET) | ||
class LiveReloadServletConfiguration { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This configuration contains Servlet-specific bits needed to set up everything. If something like this is a viable approach, I assume WebFlux-specific equivalent is needed as well (I've never used Dev Tools with WebFlux so I'm unaware if there are any limitations).
private final String scriptSnippet; | ||
|
||
public LiveReloadScriptFilter(int liveReloadPort) { | ||
this.scriptSnippet = String.format("<script src=\"/livereload.js?port=%d\"></script>", liveReloadPort); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps something to consider is embedding the script in what LiveReload.js readme refers to as slightly smarter way, see https://github.com/livereload/livereload-js?tab=readme-ov-file#using-livereloadjs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This updates the existing livereload.js
to latest version from https://github.com/livereload/livereload-js.
@@ -284,8 +284,6 @@ If you find such a problem, you need to request a fix with the original authors. | |||
== LiveReload | |||
|
|||
The `spring-boot-devtools` module includes an embedded LiveReload server that can be used to trigger a browser refresh when a resource is changed. | |||
LiveReload browser extensions are freely available for Chrome, Firefox and Safari. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure whether it's needed to explicitly call out here that browser extensions are no longer needed and Spring Boot provides everything needed.
This commit improves Dev Tools live reload capabilities by adding support for appending LiveReload.js script to rendered web pages.
See gh-32111