diff --git a/lib/jekyll/watcher.rb b/lib/jekyll/watcher.rb index ea49ad6..6dc1962 100644 --- a/lib/jekyll/watcher.rb +++ b/lib/jekyll/watcher.rb @@ -92,6 +92,15 @@ def to_exclude(options) ].flatten end + def to_exclude_regexps(options) + pattern_prefix = Regexp.escape(options["source"] || "") + + [ + "^\\.jekyll\\-metadata", + options.fetch("watch_exclude", []).map(&pattern_prefix.method(:+)), + ].flatten.compact.map(&Regexp.method(:new)) + end + # Paths to ignore for the watch option # # options - A Hash of options passed to the command @@ -116,7 +125,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