Permalink
Browse files

Fixed options.filename, exposing to template engines

this is useful for performing relative
lookups within the template engine itself,
without manually specifyin the path
  • Loading branch information...
1 parent c0aab36 commit 93189ad0b698f6f4dc68f2e31513872c2c2f8210 @tj tj committed Jul 14, 2011
Showing with 1 addition and 2 deletions.
  1. +0 −1 docs/guide.md
  2. +1 −1 lib/view.js
View
@@ -1237,7 +1237,6 @@ as well as the _name()_ function exposed.
Express also provides a few locals by default:
- `settings` the app's settings object
- - `filename` the view's filename
- `layout(path)` specify the layout from within a view
This method is aliased as _app.locals()_.
View
@@ -61,6 +61,7 @@ exports.compile = function(view, cache, cid, options){
}
// compile
+ options.filename = view.path;
view.fn = view.templateEngine.compile(view.contents, options);
cache[cid] = view;
@@ -413,7 +414,6 @@ res._render = function(view, opts, fn, parent, sub){
// View lookup
options.hint = app.enabled('hints');
view = exports.compile(view, app.cache, cid, options);
- options.filename = view.path;
// layout helper
options.layout = function(path){

0 comments on commit 93189ad

Please sign in to comment.