Skip to content

Commit

Permalink
fix body
Browse files Browse the repository at this point in the history
  • Loading branch information
JacksonTian committed Dec 5, 2016
1 parent eb09478 commit 52955bb
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/index.js
Expand Up @@ -88,7 +88,7 @@ function compile(file, options, cb) {
}

function renderFile(file, options, fn){

console.log(arguments);
// Express used to set options.locals for us, but now we do it ourselves
// (EJS does some __proto__ magic to expose these funcs/values in the template)
if (!options.locals) {
Expand Down Expand Up @@ -160,7 +160,7 @@ function renderFile(file, options, fn){
}

// now recurse and use the current result as `body` in the layout:
options.locals.body = html;
options.body = html;
renderFile(layout, options, fn);
} else {
// no layout, just do the default:
Expand Down Expand Up @@ -240,17 +240,17 @@ function lookup(root, partial, options){
// _ prefix takes precedence over the direct path
// ex: for partial('user') look for /root/_user.ejs
partial = resolve(root, dir,'_'+base+ext);
if( exists(partial) ) return options.cache ? cache[key] = partial : partial;
if (exists(partial)) return options.cache ? cache[key] = partial : partial;

// Try the direct path
// ex: for partial('user') look for /root/user.ejs
partial = resolve(root, dir, base+ext);
if( exists(partial) ) return options.cache ? cache[key] = partial : partial;
if (exists(partial)) return options.cache ? cache[key] = partial : partial;

// Try index
// ex: for partial('user') look for /root/user/index.ejs
partial = resolve(root, dir, base, 'index'+ext);
if( exists(partial) ) return options.cache ? cache[key] = partial : partial;
if (exists(partial)) return options.cache ? cache[key] = partial : partial;

// Try relative to the app views
if (!options._isRelativeToViews) {
Expand Down

0 comments on commit 52955bb

Please sign in to comment.