Disable file watching completely when watcher_disable is true

This commit is contained in:
Jim Dalton 2016-01-27 20:56:17 -08:00
parent 2bba7888b0
commit cc36267de5

View file

@ -151,19 +151,19 @@ module Middleman
config[:ssl_private_key] = opts[:ssl_private_key] if opts[:ssl_private_key] config[:ssl_private_key] = opts[:ssl_private_key] if opts[:ssl_private_key]
ready do 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] 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. # Hack around node_modules in root.
watcher.listener.ignore(/^node_modules/) watcher.listener.ignore(/^node_modules/)