Reload on view files
activestylus opened this issue · 2 comments
This has been working a treat on my inline templates, but all bets are off when I use Roda's view plugin to load templates from files. I have to manually restart each time my templates change.
Perhaps something like Unreloader.watch 'views/**/*.erb'
is needed?
Curious how you handle this in your normal dev workflow
rack-unreloader will only look for changes in *.rb
files, so it can unload the constants and rerequire the file if a change is detected. So it won't ever look for changes in template files, by design.
With Roda, just use the :cache => false
render plugin option in development mode, then templates won't be cached at all. I assume other web frameworks have similar settings.
Nice one!
For anyone else who wants to do this in dev, here is the snippet:
#At top of file
RACK_ENV = ENV['RACK_ENV'] ||= 'development' unless defined?(RACK_ENV)
# Inside app class
plugin :render, cache: (RACK_ENV!='development')