Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Updated to ejs 0.8.3, added support for include directive

  • Loading branch information...
commit 6055829c2a6b9f001b74f6b2a474d99905bd09e6 1 parent 0114f48
@nicjansma nicjansma authored
Showing with 6 additions and 4 deletions.
  1. +5 −3 lib/main.js
  2. +1 −1  package.json
View
8 lib/main.js
@@ -31,7 +31,7 @@ var EmailTemplate = function(templateDirectory, defaults, done) {
this.text = '';
this.stylesheet = '';
this.bufferType = ''
- this.render = function(locals, html, text, stylesheet, bufferType, callback) {
+ this.render = function(locals, templatePath, html, text, stylesheet, bufferType, callback) {
// Check if `bufferType` is a function (callback), or string
var isBuffer = false
if (typeof bufferType === 'function') {
@@ -59,7 +59,9 @@ var EmailTemplate = function(templateDirectory, defaults, done) {
if (!text) text = that.text
if (!stylesheet) stylesheet = that.stylesheet
locals = _.defaults(locals, (typeof defaults === 'object') ? defaults : {});
+ locals.filename = path.join(templatePath, 'html.ejs');
html = ejs.render(html, locals);
+ locals.filename = path.join(templatePath, 'text.ejs');
text = (text) ? ejs.render(text, locals) : '';
if (stylesheet) html = juice(html, stylesheet);
@@ -128,9 +130,9 @@ var EmailTemplate = function(templateDirectory, defaults, done) {
return callback(null, that.render);
}
if (isBuffer) {
- that.render(locals, null, null, null, bufferType, callback)
+ that.render(locals, templatePath, null, null, null, bufferType, callback)
} else {
- that.render(locals, null, null, null, callback)
+ that.render(locals, templatePath, null, null, null, callback)
}
//that.render(locals, callback);
};
View
2  package.json
@@ -18,7 +18,7 @@
}
, "main": "lib/main.js"
, "dependencies": {
- "ejs": "0.7.1"
+ "ejs": "0.8.3"
, "juice": "https://github.com/niftylettuce/juice/tarball/master"
, "async": "0.1.22"
, "underscore": "1.3.3"
Please sign in to comment.
Something went wrong with that request. Please try again.