Erik Zaadi

The tales of a developer with passion for dad jokes

Using Live Reload with Octopress

Live Reload is an awesome Mac app and browser extension which reloads your browser automagically when editing a file. Needless to save, it’s a bliss, never to {CMD,ctrl} + R again.

For those of us who are Mac less, the App is of course not available. Ruby to the rescue!

Install the LiveReload browser extension, see long explanation.

Edit Gemfile and add the following two lines:

1
2
3
4
5
6
7
source "http://rubygems.org"

group :development do
  ...
  gem 'guard'
  gem 'guard-livereload'
end

Create a Guardfile with the following content:

1
2
3
guard 'livereload' do
  watch(%r{public/.+\.(css|js|html)})
end

Open two terminal sessions (or panes if you’re a champ using TMUX):

rake generate && rake watch

guard

Open your browser and press the LiveReload icon, and voila! You’re set!

Share on: