Skip to content

Commit

Permalink
fix(ignore): ignore files specificed in :ignore config
Browse files Browse the repository at this point in the history
  • Loading branch information
jessepollak committed May 4, 2016
1 parent 0f0d711 commit d0ac967
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/middleman-livereload/extension_3_1.rb
Expand Up @@ -35,15 +35,22 @@ def initialize(app, options_hash={}, &block)
livereload_css_target = options.livereload_css_target
livereload_css_pattern = options.livereload_css_pattern

extension = self

app.ready do
if @reactor
@reactor.app = self
else
@reactor = ::Middleman::LiveReload::Reactor.new(options_hash, self)
end

ignored = lambda do |file|
return true if files.respond_to?(:ignored) && files.send(:ignored?, file)
extension.options.ignore.any? { |i| file.to_s.match(i) }
end

files.changed do |file|
next if files.respond_to?(:ignored?) && files.send(:ignored?, file)
next if ignored.call(file)

logger.debug "LiveReload: File changed - #{file}"

Expand All @@ -68,7 +75,7 @@ def initialize(app, options_hash={}, &block)
end

files.deleted do |file|
next if files.respond_to?(:ignored?) && files.send(:ignored?, file)
next if ignored.call(file)

logger.debug "LiveReload: File deleted - #{file}"

Expand Down

0 comments on commit d0ac967

Please sign in to comment.