Usage

Cezary Baginski edited this page Feb 13, 2016 · 1 revision
Clone this wiki locally

Usage

Overview

Livereload tells your browser to refresh when files change.

For this to work, guard-livereload has to somehow send the livereload.js script to your browser.

There are 2 ways to do this:

  1. Use a LiveReload plugin in your browser
  2. Add a special snippet to your web page (automatically or manually)

1. Using a LiveReload plugin in your browser

  1. Run guard so guard-livereload starts listening for browser connections
  2. Start your app or server (rails s, jekyll serve, rackup, etc.)
  3. Find a livereload plugin for your browser and install it
  4. In your browser, open the url you're working on, e.g. http://localhost:3000/about
  5. In your browser, enable LiveReload on that page, e.g. click the livereload toolbar icon in Chrome (until the little circle becomes filled in) or in Safari right-click on the page and enable LiveReload

2. Adding a snippet to your web page

If you're using Rails or Sinatra, you may just check out: https://github.com/johnbintz/rack-livereload#readme

(This automatically adds the snippet to every page served to the browser)

If you're not using a Rack-based server, you can manually add the snippet as described here: http://feedback.livereload.com/knowledgebase/articles/86180-how-do-i-add-the-script-tag-manually-

(Of course, you probably don't want the snippet added on your production code).

More info

http://feedback.livereload.com/knowledgebase/articles/87979-how-do-i-choose-the-best-integration-method-