Go to file
John Bintz eccebca01f override the host. now it is complete. no more changes ever need to be made to this. ever. 2011-11-07 09:11:27 -05:00
js initial commit 2011-11-04 11:51:22 -04:00
lib override the host. now it is complete. no more changes ever need to be made to this. ever. 2011-11-07 09:11:27 -05:00
spec override the host. now it is complete. no more changes ever need to be made to this. ever. 2011-11-07 09:11:27 -05:00
.gitignore initial commit 2011-11-04 11:51:22 -04:00
Gemfile initial commit 2011-11-04 11:51:22 -04:00
Guardfile a few more fixes 2011-11-07 08:49:42 -05:00
README.md override the host. now it is complete. no more changes ever need to be made to this. ever. 2011-11-07 09:11:27 -05:00
Rakefile initial commit 2011-11-04 11:51:22 -04:00
config.ru initial commit 2011-11-04 11:51:22 -04:00
rack-livereload.gemspec update gemspec to keep bundler from yelling 2011-11-04 13:29:13 -04:00

README.md

Hey, you've got LiveReload in my Rack! No need for browser extensions anymore! Just plug it in your middleware stack and go!

Use this with guard-livereload for maximum fun!

Using in...

Rails

In config/environments/development.rb:

MyApp::Application.configure do
  config.middleware.insert_before(Rack::Lock, Rack::LiveReload)

  # ...or, change some options...

  config.middleware.insert_before(
    Rack::Lock, Rack::LiveReload,
    :min_delay => 500,
    :max_delay => 10000,
    :port => 56789,
    :host => 'myhost.cool.wow'
  )
end

config.ru/Sinatra

require 'rack-livereload'

use Rack::LiveReload
# ...or...
use Rack::LiveReload, :min_delay => 500, ...

How it works

The necessary script tag to bring in a vendored copy of livereload.js is injected right before the closing head tag in any text/html pages that come through. The script tag is built in such a way that the HTTP_HOST is used as the LiveReload host, so you can connect from external machines (say, to mycomputer:3000 instead of localhost:3000) and as long as the LiveReload port is accessible from the external machine, you'll connect and be LiveReloading away!

As usual, super-alpha!