1
0
Fork 0
mirror of https://github.com/middleman/middleman.git synced 2022-11-09 12:20:27 -05:00
middleman--middleman/lib/middleman/features/live_reload.rb

26 lines
632 B
Ruby
Raw Normal View History

2010-09-21 21:30:17 -04:00
module Middleman::Features::LiveReload
class << self
def registered(app)
return unless Middleman::Server.environment == :development
begin
require 'livereload'
rescue LoadError
puts "Livereload not available. Install it with: gem install livereload"
end
new_config = ::LiveReload::Config.new do |config|
2011-06-05 15:44:57 -04:00
::Tilt.mappings.each do |key, v|
config.exts << key
end
2010-09-21 21:30:17 -04:00
end
2011-06-05 15:44:57 -04:00
pid = fork {
require 'livereload'
::LiveReload.run [Middleman::Server.views], new_config
}
2010-09-21 21:30:17 -04:00
end
alias :included :registered
end
end