简体   繁体   中英

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM