From 089459bac4b2f62a55f1f6f687115bfefc0b0399 Mon Sep 17 00:00:00 2001 From: MoHKale Date: Sat, 28 Dec 2019 14:51:38 +0000 Subject: [PATCH] add watch_exclude setting to _config.yml --- lib/jekyll/watcher.rb | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/jekyll/watcher.rb b/lib/jekyll/watcher.rb index ea49ad6..b35812b 100644 --- a/lib/jekyll/watcher.rb +++ b/lib/jekyll/watcher.rb @@ -92,13 +92,20 @@ def to_exclude(options) ].flatten end + def to_exclude_regexps(options) + [ + "^\\.jekyll\\-metadata", + options.fetch("watch_exclude", nil), + ].flatten.compact.map(&Regexp.method(:new)) + end + # Paths to ignore for the watch option # # options - A Hash of options passed to the command # # Returns a list of relative paths from source that should be ignored def listen_ignore_paths(options) - source = Pathname.new(options["source"]).expand_path + source = Pathname.new(options["source"]).expand_path + ".*" paths = to_exclude(options) paths.map do |p| @@ -116,7 +123,7 @@ def listen_ignore_paths(options) rescue ArgumentError # Could not find a relative path end - end.compact + [%r!^\.jekyll\-metadata!] + end.compact + to_exclude_regexps(options) end def sleep_forever