lib/guard/livereload/templates/Guardfile in guard-livereload-2.4.0 vs lib/guard/livereload/templates/Guardfile in guard-livereload-2.5.0

- old
+ new

@@ -1,8 +1,38 @@ guard 'livereload' do - watch(%r{app/views/.+\.(erb|haml|slim)$}) + extensions = { + css: :css, + scss: :css, + sass: :css, + js: :js, + coffee: :js, + html: :html, + png: :png, + gif: :gif, + jpg: :jpg, + jpeg: :jpeg, + # less: :less, # uncomment if you want LESS stylesheets done in browser + } + + rails_view_exts = %w(erb haml slim) + + # file types LiveReload may optimize refresh for + compiled_exts = extensions.values.uniq + watch(%r{public/.+\.(#{compiled_exts * '|'})}) + + extensions.each do |ext, type| + watch(%r{ + (?:app|vendor) + (?:/assets/\w+/(?<path>[^.]+) # path+base without extension + (?<ext>\.#{ext})) # matching extension (must be first encountered) + (?:\.\w+|$) # other extensions + }x) do |m| + path = m[1] + "/assets/#{path}.#{type}" + end + end + + # file needing a full reload of the page anyway + watch(%r{app/views/.+\.(#{rails_view_exts * '|'})$}) watch(%r{app/helpers/.+\.rb}) - watch(%r{public/.+\.(css|js|html)}) watch(%r{config/locales/.+\.yml}) - # Rails Assets Pipeline - watch(%r{(app|vendor)(/assets/\w+/(.+\.(css|js|html|png|jpg))).*}) { |m| "/assets/#{m[3]}" } end