diff --git a/middleman-core/lib/middleman-core/cli/server.rb b/middleman-core/lib/middleman-core/cli/server.rb index e69c9970..931b69de 100644 --- a/middleman-core/lib/middleman-core/cli/server.rb +++ b/middleman-core/lib/middleman-core/cli/server.rb @@ -45,6 +45,11 @@ module Middleman::Cli :type => :boolean, :default => false, :desc => 'Force file watcher into polling mode' + method_option :latency, + :type => :numeric, + :aliases => "-l", + :default => 0.25, + :desc => 'Set file watcher latency, in seconds' # Start the server def server @@ -66,7 +71,8 @@ module Middleman::Cli :instrumenting => options["instrument"], :disable_watcher => options["disable_watcher"], :reload_paths => options["reload_paths"], - :force_polling => options["force_polling"] + :force_polling => options["force_polling"], + :latency => options["latency"] } puts "== The Middleman is loading" diff --git a/middleman-core/lib/middleman-core/preview_server.rb b/middleman-core/lib/middleman-core/preview_server.rb index af6537ef..34c55cb6 100644 --- a/middleman-core/lib/middleman-core/preview_server.rb +++ b/middleman-core/lib/middleman-core/preview_server.rb @@ -104,6 +104,7 @@ module Middleman # Watcher Library require "listen" @listener = Listen.to(Dir.pwd, :relative_paths => true, :force_polling => @options[:force_polling]) + @listener.latency(@options[:latency]) end @listener.change do |modified, added, removed|