Module: Middleman::Features::LiveReload

Defined in:
lib/middleman/features/live_reload.rb

Class Method Summary collapse

Class Method Details

.registered(app) ⇒ Object Also known as: included



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/middleman/features/live_reload.rb', line 3

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|
    config.exts = ::Tilt.mappings.keys
  end

  # Middleman::Server.public
  ::LiveReload.run [Middleman::Server.views], new_config
end