template-mjml v1.0.3
Template MJML
Generates HTML files from multiple element files and a single MJML template file.
Element files are template files (i.e. a newsletter and a form), which will each be inserted into the parent template file.
Usage
First, in your MJML template file, add a mj-wrapper element under the children of the mj-body element where the elements should be inserted, as follows:
{
"tagName": "mj-body",
"children": [
{
"tagName": "mj-wrapper",
}
]
}
}It doesn't matter whether the mj-wrapper element is the first or last child, it is however required to put the mj-wrapper element as a child of the mj-body element.
Next, create a folder (i.e. elements) from which the program can insert the elements into the template file to generate HTML files.
The following options exist for the program:
-t --templatespecifies which template file to use:
template-mjml -t 'template.json'-i --input-folderspecifies the input folder for the elements:
template-mjml -i './elements/'-o --output-folderspecifies the output folder for the generated HTML files:
template-mjml -o './output/'-e --file-extensionspecifies the file extension to use for the generated HTML files:
template-mjml -e '.html'If a value is omitted, the standard values will be used, these are:
template.jsonfor the template option./elementsfor the input folder option./outputfor the output folder option.htmlfor the file extension option