Class CssLiveReload
style/application.css.
JavaFX caches parsed style sheets per URL, so re-adding the same URL has no effect. This watcher therefore writes every change to a newly named copy in a temp directory and swaps the scene's style sheet entry — JavaFX then parses the fresh URL and applies the rules immediately. No restart needed while tweaking padding, fonts or colours.
It only activates for a development run: the style sheet must be a file: URL below
target/classes and the matching src/main/resources source file must exist. In a
packaged application (JAR URL) it does nothing. It is off by default and has to be
switched on explicitly with -Dapp.livereload=true on the command line (e.g. in the
application's start script).
Java code still needs a rebuild and restart; this covers style changes only.
-
Method Summary
-
Method Details
-
install
Start watching the source file behindstylesheetUrland keep the scene up to date.- Parameters:
scene- the live scene whose style sheet entry is swappedstylesheetUrl- thestyle/application.cssURL that was added to the sceneappId- app ID; one word, no spaces
-