Skip to content

Commit

Permalink
add watch_exclude setting to _config.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
mohkale committed Dec 28, 2019
1 parent 12726f3 commit 2eef38d
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/jekyll/watcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 2eef38d

Please sign in to comment.