This plugin integrates livereload-js with Grails:
- It starts WebSocket server when you start your application
- It sends message to the client when you change
css
orjs
file - livereload-js updates css files (without page refresh) or refreshes pages to reload js file
livereload-js uses WebSocket to communicate with server. So this plugin doesn't work with browsers that doesn't support WebSocket
Plugin installation requires 3 steps to be done:
- Add plugin to your
BuildConfig.groovy
:compile ":livereload:0.2"
- Configure plugin (check section "Configuration")
- Add js file to you layout (check section "Adding livereload.js")
By default plugin is disabled. To enable css
reloading add plugin.livereload.css = true
in your Config.groovy
.
To enable js
reloading add plugin.livereload.js = true
. To enable css
and js
reloading you can use following syntax:
plugin {
livereload {
css = true
js = true
}
}
Add <livereload:js/>
right before </body>
. js
method of livereload
TagLib will add livereload.js
file into response HTML only when livereload is enabled.
If livereload is disabled (plugin.livereload.css == false && plugin.livereload.js == false
) it does nothing.
If you have any problems or suggestions pls feel free to ask me - I'll be glad to answer you.