Created
June 26, 2014 23:47
-
-
Save metasansana/d043fbeb3338c5ab1622 to your computer and use it in GitHub Desktop.
Render email templates with nunjucks in KeystoneJS.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Email is a wrapper around the keystone Email object. | |
* @class Email | |
* | |
* @constructor | |
* | |
*/ | |
module.exports = function Email(name, keystone, nunjucks) { | |
return new keystone.Email({ | |
templateExt: 'html', | |
templateEngine: { | |
compile: function(html, paths) { | |
return function(locals) { | |
return nunjucks.renderString(html, locals); | |
}; | |
} | |
}, | |
templateName: name, | |
templateBasePath: keystone.get('emails'), | |
mandrill: { | |
track_opens: true, | |
track_clicks: true, | |
preserve_recipients: false, | |
inline_css: true | |
} | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment