Using handlebars to create your email templates with ease.
npm install handlebars-email-template
- data
data.json
- views
- partials
table-row.hbs
email.hbs
- index.js
You can use the HTML Snippets - Email Template as a starting point for your template.
var handlebarsEmailTemplate = require('handlebars-email-template');
var options = {
root: 'views', // This is the root of your templates folder
src: '_partials', // Partials folder
dest: 'compiled', // Destination directory
srcTemplate: 'email', // Src Template
destTemplate: 'email', // Destination Template Name
ext: 'hbs',
data: 'data/data.json' // Path to data file
};
handlebarsEmailTemplate(options);
// Expected output
//- compiled
// - email.html
root
- This is the root of your templates directorysrc
- Partials directorydest
- Output directorysrcTemplate
- Name of the template eg:email.hbs
destTemplate
- Name of output file.data
- path to data.