Skip to content

LiveReload module fix #670#678

Merged
jknack merged 1 commit intomasterfrom
670
Mar 20, 2017
Merged

LiveReload module fix #670#678
jknack merged 1 commit intomasterfrom
670

Conversation

@jknack
Copy link
Copy Markdown
Member

@jknack jknack commented Mar 20, 2017

liveReload

LiveReload monitors changes in the file system. As soon as you save a file, it is preprocessed as needed, and the browser is refreshed.

Even cooler, when you change a CSS file or an image, the browser is updated instantly without reloading the page.

exports

  • livereload.js route
  • livereload websocket

dependency

<dependency>
 <groupId>org.jooby</groupId>
 <artifactId>jooby-livereload</artifactId>
 <version>{{version}}</version>
</dependency>

usage

{
  use(new Jackson());

  use(new LiveReload());
}

This module is available as long you run in development: application.env=dev.

configuration

browser extension

Install the LiveReload browser extension.

livereload.js

Add the livereload.js to your web page.

You can do this manually:

<script src="/livereload.js"></script>

Or use the liveReload local variable with your preferred template engine. Here is an example using Handlebars:

{{liveReload}}

json module

The LiveReload Protocol run on top of a WebSocket and uses JSON as protocol format. That's is why we also need to install a JSON module, like Jackson.

watcher

It automatically reload static resources from public, target (Maven projects) or build folders (Gradle projects).

Every time a change is detected the websocket send a reload command.

That's all folks!!

@jknack jknack added the feature label Mar 20, 2017
@jknack jknack added this to the 1.1.0 milestone Mar 20, 2017
@jknack jknack requested a review from krisztiankocsis March 20, 2017 01:00
Copy link
Copy Markdown
Member

@krisztiankocsis krisztiankocsis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

@jknack jknack merged commit 41713db into master Mar 20, 2017
@jknack jknack deleted the 670 branch June 4, 2017 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants