Rails Livereload
We’ve been experimenting with Ruby on Rails a bit lately and one of the things that we were missing out of the box was livereload. Turns out it’s not too tough to get it up an running.
The CliffsNotes
In your gemfile:
group :development do
gem 'guard'
gem 'rack-livereload'
gem 'guard-livereload', require: false
endIn config/environments/development.rb
config.middleware.use Rack::LiveReloadInstall new gems via terminal
bundle installCreate your Gaurdefile
bundle exec guard initLaunch Gaurd
bundle exec guardStart your rails server in another terminal
rails serverThe Details
-
Install Guard, just follow the instructions on the repo https://github.com/guard/guard
-
Install rack-livereload https://github.com/johnbintz/rack-livereload
-
Install guard-livereload https://github.com/guard/guard-livereload
The Caveats
It always seems to take a bit to get up and running for some reason. Not sure why but it takes it compiles everything for you without any further configuration like you might have with a detailed Gruntfile. Super cool.
It would be nice if this could be built into some sort of boilerplate for rails projects. Something to research further I suppose…