class Middleman::CoreExtensions::FileWatcher::API

def reload_path(path, only_new=false)

Returns:
  • (void) -

Parameters:
  • only_new (Boolean) -- Whether we only look for new files
  • path (Pathname) -- The path to reload
def reload_path(path, only_new=false)
  # chdir into the root directory so Pathname can work with relative paths
  Dir.chdir @app.root_path do
    path = Pathname(path)
    return unless path.exist?
    glob = (path + "**").to_s
    subset = @known_paths.select { |p| p.fnmatch(glob) }
    ::Middleman::Util.all_files_under(path).each do |filepath|
      next if only_new && subset.include?(filepath)
      subset.delete(filepath)
      did_change(filepath)
    end
    subset.each(&method(:did_delete)) unless only_new
  end
end