mbajur
mbajur

Reputation: 4484

Watch rails views and reload page on changes

I'm currently using webpacker with page reloading on css/js changes and it all works just great. I was wondering - is that possible to do the same for rails views? It would be great if updating erb or slim view could trigger a webpack page refresh (ideally without rebuilding entire js/css bundle).

I know there are solutions like guard and browsersync for that but i would love to avoid using yet another deamon running in the background.

Upvotes: 2

Views: 1832

Answers (1)

coorasse
coorasse

Reputation: 5528

I would use guard-livereload (https://github.com/guard/guard-livereload) and exclude js and css files since are already watched by webpacker-dev-server.

guard 'livereload' do
  watch(%r{app/views/.+\.(erb|haml|slim)})
  watch(%r{app/helpers/.+\.rb})      
  watch(%r{config/locales/.+\.yml})      
end

Upvotes: 2

Related Questions