tpl-emails
Generate HTML emails using templating engine (nunjuncks by default). Inspired by andrewrk/swig-email-templates.
Features
- Uses nunjucks, which supports Django-inspired template inheritance. You can provide your render method.
- Uses juice, which takes an HTML file and inlines all the
<link rel="stylesheet">
s and the<style>
s. - URL rewrite support - you can provide a
urlRewrite
option to rewrite your links. - Text emails - for a template name passed into render(), if a file exists with the same name but a .txt extension it will be rendered separately. If the .txt file does not exist, html-to-text will auto-generate a text version of the html file. This can be disabled with the option
text: false
.
Usage
var path = ;var TplEmails = ; var emails = root: path; emails;
Use your own templating engine
For example to use underscore/lodash templating engine:
var fs = ;var _ = ;var TplEmails = ; var emails = { var content = fs; ; }; emails;