Permalink
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...
1 parent 5b2847d commit 520f8971962a68b74305bbdb7529cf76c7cc27ba @vekexasia vekexasia committed Nov 1, 2012
Showing with 5 additions and 1 deletion.
  1. +5 −1 lib/main.js
View
@@ -51,14 +51,18 @@ 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
locals = _.defaults(locals, (typeof defaults === 'object') ? defaults : {});
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) {

0 comments on commit 520f897

Please sign in to comment.