Skip to content
Myr

Fixed options.filename, exposing to template engines

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

this is useful for performing relative lookups within the template engine itself, without manually specifyin the path

authored by Tj Holowaychuk · committed by Tj Holowaychuk · parent fa31d45 · Browse files · 2 files+1 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

2 files+1 added−2 removed

  • other:+1 added−2 removed

2 files+1 added−2 removed

modified:docs/guide.md-1 removed
1166 unmodified lines
11671168Express also provides a few locals by default:11691170 - `settings` the app's settings object1171 - `filename` the view's filename1171 - `layout(path)` specify the layout from within a view11721173### app.dynamicLocals(obj)1174
179 unmodified lines
modified:lib/view.js+1 added-1 removed
59 unmodified lines
60 throw err;61 } 6263 // compile64 options.filename = view.path;65 view.fn = view.templateEngine.compile(view.contents, options);66 cache[cid] = view;67 68 return view;
340 unmodified lines
409410 // View lookup411 options.hint = app.enabled('hints');412 view = exports.compile(view, app.cache, cid, options);412 options.filename = view.path;413414 // layout helper415 options.layout = function(path){416 layout = path;
39 unmodified lines