[英]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. 我目前正在使用webpacker并在css / js更改中重新加载页面,并且一切都很好。 I was wondering - is that possible to do the same for rails views?
我想知道-是否可以对Rails视图执行相同操作? It would be great if updating erb or slim view could trigger a webpack page refresh (ideally without rebuilding entire js/css bundle).
如果更新erb或slim view可以触发webpack页面刷新(最好不重建整个js / css包),那就太好了。
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. 我知道可以使用诸如guard和browsersync之类的解决方案,但我希望避免使用在后台运行的另一个守护进程。
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( https://github.com/guard/guard-livereload )并排除js和css文件,因为webpacker-dev-server已经对其进行了监视。
guard 'livereload' do
watch(%r{app/views/.+\.(erb|haml|slim)})
watch(%r{app/helpers/.+\.rb})
watch(%r{config/locales/.+\.yml})
end
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.