mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-09 07:28:41 -07:00
Add livereload
This commit is contained in:
parent
dbfc9d1d3a
commit
cbb516bcea
4 changed files with 122 additions and 67 deletions
39
Guardfile
39
Guardfile
|
|
@ -68,3 +68,42 @@ guard :rspec, cmd: "bundle exec rspec" do
|
|||
Dir[File.join("**/#{m[1]}.feature")][0] || "spec/acceptance"
|
||||
end
|
||||
end
|
||||
|
||||
guard 'livereload' do
|
||||
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{config/locales/.+\.yml})
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue