Create email template with Nunjucks syntax and MJML
yarn add michml
npm install michml
You can see example in 'examples' folder.
const michel = new MichML();
const html = michel.pathToHTML(__dirname + "/templates/template.mjml", { template_data } })
const michML_module = require('michml')
const michel = new michML_module.MichML()
const html = michel.pathToHTML(__dirname + "/templates/template.mjml", { template_data } })
You can configure MJML to HTML transformation
const options = {
// Option to beautify the HTML output (default : false )
beautify: boolean;
// Option to keep comments in the HTML output ( default : true )
keepComments: boolean;
// Option to minify the HTML output ( default : false )
minify: boolean;
// Available values for the validator: 'strict', 'soft', 'skip' ( defaullt : 'soft' )
validationLevel: "strict" | "soft" | "skip";
}
const michel = new MichML(options)