class Middleman::CoreExtensions::FileWatcher
API for watching file change events
def after_configuration
def after_configuration if @original_source_dir != app.config[:source] @watcher.update_path(app.config[:source]) end @sources.start! @sources.find_new_files! end
def before_configuration
def before_configuration @sources.find_new_files! end
def initialize(app, config={}, &block)
def initialize(app, config={}, &block) super # Setup source collection. @sources = ::Middleman::Sources.new(app, disable_watcher: app.config[:watcher_disable], force_polling: app.config[:watcher_force_polling], latency: app.config[:watcher_latency]) # Add default ignores. IGNORES.each do |key, value| @sources.ignore key, :all, value end # Watch current source. start_watching(app.config[:source]) end
def start_watching(dir)
def start_watching(dir) @original_source_dir = dir @watcher = @sources.watch :source, path: File.join(app.root, dir) end