Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix the batch problem ( has no method slice )

You can't pass to ejs.render() a function so if html is a function ( probably in batch mode ) then we set the html to that.html before calling ejs.render.
  • Loading branch information...
commit 520f8971962a68b74305bbdb7529cf76c7cc27ba 1 parent 5b2847d
@vekexasia vekexasia authored
Showing with 5 additions and 1 deletion.
  1. +5 −1 lib/main.js
View
6 lib/main.js
@@ -51,6 +51,10 @@ var EmailTemplate = function(templateDirectory, defaults, done) {
bufferType = that.bufferType
}
+ if (typeof html === 'function') {
+ callback = html;
+ html = that.html;
+ }
if (!html) html = that.html
if (!text) text = that.text
if (!stylesheet) stylesheet = that.stylesheet
@@ -58,7 +62,7 @@ var EmailTemplate = function(templateDirectory, defaults, done) {
html = ejs.render(html, locals);
text = (text) ? ejs.render(text, locals) : '';
if (stylesheet) html = juice(html, stylesheet);
- if (typeof html === 'function') callback = html;
+
// return a compressed buffer
if (isBuffer) {
Please sign in to comment.
Something went wrong with that request. Please try again.