From cc36267de51f5ef2e39ef9b8d4ad7b6926c63f64 Mon Sep 17 00:00:00 2001 From: Jim Dalton Date: Wed, 27 Jan 2016 20:56:17 -0800 Subject: [PATCH] Disable file watching completely when watcher_disable is true --- .../lib/middleman-core/preview_server.rb | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/middleman-core/lib/middleman-core/preview_server.rb b/middleman-core/lib/middleman-core/preview_server.rb index acdb367d..d901bbca 100644 --- a/middleman-core/lib/middleman-core/preview_server.rb +++ b/middleman-core/lib/middleman-core/preview_server.rb @@ -151,19 +151,19 @@ module Middleman config[:ssl_private_key] = opts[:ssl_private_key] if opts[:ssl_private_key] ready do - match_against = [ - %r{^config\.rb$}, - %r{^environments/[^\.](.*)\.rb$}, - %r{^lib/[^\.](.*)\.rb$}, - %r{^#{config[:helpers_dir]}/[^\.](.*)\.rb$} - ] - - # config.rb - watcher = files.watch :reload, - path: root, - only: match_against - unless config[:watcher_disable] + match_against = [ + %r{^config\.rb$}, + %r{^environments/[^\.](.*)\.rb$}, + %r{^lib/[^\.](.*)\.rb$}, + %r{^#{config[:helpers_dir]}/[^\.](.*)\.rb$} + ] + + # config.rb + watcher = files.watch :reload, + path: root, + only: match_against + # Hack around node_modules in root. watcher.listener.ignore(/^node_modules/)