mirror of
https://github.com/sinatra/sinatra
synced 2023-03-27 23:18:01 -04:00
reload_templates setting; on by default in :development [#321]
Enabling the reload_templates setting causes template files to be reread from disk and recompiled on each request. It's disabled by default in all environments except for development.
This commit is contained in:
parent
0781c28fc3
commit
f889c75cd4
2 changed files with 7 additions and 2 deletions
5
CHANGES
5
CHANGES
|
@ -9,9 +9,12 @@
|
|||
template backtraces, and support for new template engines, like
|
||||
mustache and liquid.
|
||||
|
||||
* New boolean 'reload_templates' setting controls whether template files
|
||||
are reread from disk and recompiled on each request. Template read/compile
|
||||
is cached by default in all environments except development.
|
||||
|
||||
* New 'settings' method gives access to options in both class and request
|
||||
scopes. This replaces the 'options' method.
|
||||
|
||||
* New 'erubis' helper method for rendering Erubis templates.
|
||||
|
||||
* New 'expires' helper method is like cache_control but takes an
|
||||
|
|
|
@ -387,6 +387,7 @@ module Sinatra
|
|||
@request = Request.new(env)
|
||||
@response = Response.new
|
||||
@params = indifferent_params(@request.params)
|
||||
@template_cache.clear if settings.reload_templates
|
||||
|
||||
invoke { dispatch! }
|
||||
invoke { error_block!(response.status) }
|
||||
|
@ -1039,8 +1040,9 @@ module Sinatra
|
|||
|
||||
set :app_file, nil
|
||||
set :root, Proc.new { app_file && File.expand_path(File.dirname(app_file)) }
|
||||
set :views, Proc.new { root && File.join(root, 'views') }
|
||||
set :public, Proc.new { root && File.join(root, 'public') }
|
||||
set :views, Proc.new { root && File.join(root, 'views') }
|
||||
set :reload_templates, Proc.new { !development? }
|
||||
set :lock, false
|
||||
|
||||
error ::Exception do
|
||||
|
|
Loading…
Add table
Reference in a new issue