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 --template
specifies which template file to use:
template-mjml -t 'template.json'
-i --input-folder
specifies the input folder for the elements:
template-mjml -i './elements/'
-o --output-folder
specifies the output folder for the generated HTML files:
template-mjml -o './output/'
-e --file-extension
specifies 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.json
for the template option./elements
for the input folder option./output
for the output folder option.html
for the file extension option