Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Update ejs.js #151

Open
wants to merge 1 commit into from

1 participant

web5
Deleted user

修改inlude的路径问题,将相对当前文件路径做文件包含改为相对views的路径做文件包含

web5 web5 Update ejs.js
修改inlude的路径问题,将相对当前文件路径在inlude改为相对views的路径做文件包含
1c7ab62
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 14, 2013
  1. web5

    Update ejs.js

    web5 authored
    修改inlude的路径问题,将相对当前文件路径在inlude改为相对views的路径做文件包含
This page is out of date. Refresh to see the latest.
Showing with 3 additions and 4 deletions.
  1. +3 −4 lib/ejs.js
7 lib/ejs.js
View
@@ -1,4 +1,3 @@
-
/*!
* EJS
* Copyright(c) 2012 TJ Holowaychuk <tj@vision-media.ca>
@@ -155,7 +154,7 @@ var parse = exports.parse = function(str, options){
if (0 == js.trim().indexOf('include')) {
var name = js.trim().slice(7).trim();
if (!filename) throw new Error('filename option is required for includes');
- var path = resolveInclude(name, filename);
+ var path = resolveInclude(name, filename,options);
include = read(path, 'utf8');
include = exports.parse(include, { filename: path, _with: false, open: open, close: close, compileDebug: compileDebug });
buf += "' + (function(){" + include + "})() + '";
@@ -327,8 +326,8 @@ exports.renderFile = function(path, options, fn){
* @api private
*/
-function resolveInclude(name, filename) {
- var path = join(dirname(filename), name);
+function resolveInclude(name, filename,options) {
+ var path = join(options.settings.views, name);
var ext = extname(name);
if (!ext) path += '.ejs';
return path;
Something went wrong with that request. Please try again.