Skip to content
Myr

lookup callback

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 76b7d69 · Browse files · 1 file+8 added−5 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+8 added−5 removed

  • other:+8 added−5 removed

1 file+8 added−5 removed

modified:lib/application.js+8 added-5 removed
585 unmodified lines
586587 // render588 try {589 var engine = engines[ext] = engines[ext] || require(ext);590 this.lookup(view, function(err, path){591 if (err) return fn(err);590 opts.filename = this.lookup(view);591 view = fs.readFileSync(opts.filename, 'utf8');592 engine.render(view, opts, fn);592 opts.filename = path;593 view = fs.readFileSync(path, 'utf8');594 engine.render(view, opts, fn);595 });596 } catch (err) {597 fn(err);598 }599};600598app.lookup = function(view){601app.lookup = function(view, fn){602 var root = this.set('views') || process.cwd() + '/views';600 return join(root, view);603 fn(null, join(root, view));604};