-
Notifications
You must be signed in to change notification settings - Fork 0
3. Options
Johann Buscail edited this page Oct 17, 2021
·
4 revisions
The absolute path to your MJML file.
Name | Required | Default Value | Type |
---|---|---|---|
mjml.path | only if property code isn't provided |
none | string |
The MJML code.
Name | Required | Default Value | Type |
---|---|---|---|
mjml.code | only if property path isn't provided |
none | string |
You can pass optional options as an object to the mjml2HTMLParser
function.
Read the official documentation
The absolute path to your MJML file. https://documentation.mjml.io/#inside-node-js
Name | Required | Default Value | Type |
---|---|---|---|
mjml.options | false | {} |
https://documentation.mjml.io/#inside-node-js |
You can use multiple template engines in your mjml file:
- ejs
- handlebars
- underscore
- no-template (no template engine is used to make compilation faster)
Name | Required | Default Value | Type |
---|---|---|---|
template.engine | false | no-template |
no-template /ejs /handlebars /underscore
|
You can pass variables to your template by using the template.vars
property:
mjml2HTMLParser({
template: {
vars: {
// Your variables
}
}
})
Name | Required | Default Value | Type |
---|---|---|---|
template.vars | false | {} |
object |
Read EJS documentation to know how to use this property
Name | Required | Default Value | Type |
---|---|---|---|
template.options | false | {} |
https://ejs.co/#docs |
Read Underscore documentation to know how to use this property
Name | Required | Default Value | Type |
---|---|---|---|
template.options | false | {} |
http://underscorejs.org/#template |
There are two types of options you can pass to Handlebars:
- Precompile
- Runtime
Read Handlebars documentation to know how to use this property
Name | Required | Default Value | Type |
---|---|---|---|
template.preCompileOptions | false | {} |
https://handlebarsjs.com/api-reference/compilation.html#handlebars-compile-template-options |
Read Handlebars documentation to know how to use this property
Name | Required | Default Value | Type |
---|---|---|---|
template.runtimeOptions | false | {} |
https://handlebarsjs.com/api-reference/runtime-options |