Merge pull request #1632 from gausie/patch-2

Allow EJS templates to use includes
This commit is contained in:
Miroslav Bajtoš 2015-08-31 18:15:16 +02:00
commit bab1d5dae8
1 changed files with 3 additions and 1 deletions

View File

@ -215,7 +215,9 @@ loopback.remoteMethod = function(fn, options) {
loopback.template = function(file) {
var templates = this._templates || (this._templates = {});
var str = templates[file] || (templates[file] = fs.readFileSync(file, 'utf8'));
return ejs.compile(str);
return ejs.compile(str, {
filename: file
});
};
require('../server/current-context')(loopback);