Skip to content
This repository
Browse code

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
Andrea Baccega vekexasia authored

Showing 1 changed file with 5 additions and 1 deletion. Show diff stats Hide diff stats

  1. +5 1 lib/main.js
6 lib/main.js
@@ -51,6 +51,10 @@ var EmailTemplate = function(templateDirectory, defaults, done) {
51 51 bufferType = that.bufferType
52 52 }
53 53
  54 + if (typeof html === 'function') {
  55 + callback = html;
  56 + html = that.html;
  57 + }
54 58 if (!html) html = that.html
55 59 if (!text) text = that.text
56 60 if (!stylesheet) stylesheet = that.stylesheet
@@ -58,7 +62,7 @@ var EmailTemplate = function(templateDirectory, defaults, done) {
58 62 html = ejs.render(html, locals);
59 63 text = (text) ? ejs.render(text, locals) : '';
60 64 if (stylesheet) html = juice(html, stylesheet);
61   - if (typeof html === 'function') callback = html;
  65 +
62 66
63 67 // return a compressed buffer
64 68 if (isBuffer) {

0 comments on commit 520f897

Please sign in to comment.
Something went wrong with that request. Please try again.