mirror of
https://github.com/middleman/middleman.git
synced 2022-11-09 12:20:27 -05:00
26 lines
No EOL
632 B
Ruby
26 lines
No EOL
632 B
Ruby
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|
|
|
::Tilt.mappings.each do |key, v|
|
|
config.exts << key
|
|
end
|
|
end
|
|
|
|
pid = fork {
|
|
require 'livereload'
|
|
::LiveReload.run [Middleman::Server.views], new_config
|
|
}
|
|
|
|
end
|
|
alias :included :registered
|
|
end
|
|
end |