michml

Use MJML and Nunjucks to generate your mail HTML. Michml le MJML par Michel

Usage no npm install needed!

<script type="module">
  import michml from 'https://cdn.skypack.dev/michml';
</script>

README

michml

MichML

Build Status

Create email template with Nunjucks syntax and MJML

Installation

yarn add michml

npm install michml

How to use

You can see example in 'examples' folder.

How to use in TypeScript

const michel = new MichML();
const html = michel.pathToHTML(__dirname + "/templates/template.mjml", { template_data } })

How to use in JavaScript

const michML_module = require('michml')
const michel = new michML_module.MichML()
const html = michel.pathToHTML(__dirname + "/templates/template.mjml", { template_data } })

Configuration

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)