Skip to content
Myr

caching compiled view functions

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Tj Holowaychuk · committed by Tj Holowaychuk · parent 3d2b41d · Browse files · 1 file+7 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+7 added−2 removed

  • other:+7 added−2 removed

1 file+7 added−2 removed

modified:lib/express/view.js+7 added-2 removed
155 unmodified lines
156 , app = this.app157 , options = options || {}158 , helpers = app.viewHelpers159 , dynamicHelpers = app.dynamicViewHelpers160 , viewOptions = app.settings['view options'];160 , viewOptions = app.settings['view options']161 , cacheTemplates = 'production' == app.settings.env;162163 // Mixin "view options"164 if (viewOptions) options = merge(clone(viewOptions), options);165
59 unmodified lines
225 }226227 // Attempt render228 try {228 var template = view.templateEngine.compile(view.contents, options);229 var engine = view.templateEngine230 , contents = view.contents231 , template = cacheTemplates232 ? cache[view] || (cache[view] = engine.compile(contents, options))233 : engine.compile(contents, options);234 str = template.call(options.scope, options);235 } catch (err) {236 return error(err);237 }
15 unmodified lines