- Add support for welcome email on user creation (both OAuth and password users) - Add support for html/text templating on verify email. - Add support for html/text templating on reset password. - Add handlers for converting Handlebars templates to HTML and text (template agnostic). - Add helper function sendEmail() for compiling and sending templates via Email.send() (SMTP).
11 lines
549 B
JavaScript
11 lines
549 B
JavaScript
import handlebars from 'handlebars';
|
|
import juice from 'juice';
|
|
|
|
export default (handlebarsMarkup, context, options) => {
|
|
if (handlebarsMarkup && context) {
|
|
const template = handlebars.compile(handlebarsMarkup);
|
|
return options && !options.inlineCss ? template(context) : juice(template(context)); // Use juice to inline CSS <style></style> styles from <head> unless disabled.
|
|
}
|
|
|
|
throw new Error('Please pass Handlebars markup to compile and a context object with data mapping to the Handlebars expressions used in your template.');
|
|
};
|