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 c0aab36 · 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
1235 unmodified lines
12361237Express also provides a few locals by default:12381239 - `settings` the app's settings object1240 - `filename` the view's filename1240 - `layout(path)` specify the layout from within a view12411242This method is aliased as _app.locals()_.1243
181 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;
344 unmodified lines
413414 // View lookup415 options.hint = app.enabled('hints');416 view = exports.compile(view, app.cache, cid, options);416 options.filename = view.path;417418 // layout helper419 options.layout = function(path){420 layout = path;
39 unmodified lines