mikser-io-post-mjml
v2.0.0
Published
[MJML](https://www.npmjs.com/package/mjml) postprocessor for [Mikser](https://github.com/almero-digital-marketing/mikser-io). Compiles a rendered MJML document into responsive email-safe HTML.
Readme
mikser-io-post-mjml
MJML postprocessor for Mikser. Compiles a rendered MJML document into responsive email-safe HTML.
Install
npm install mikser-io-post-mjmlUsage
// mikser.config.js
export default {
plugins: ['post-mjml'],
'post-mjml': {
options: { keepComments: false, minify: true }
}
}'post-mjml'.options is passed through to mjml2html. The plugin sets validationLevel: 'soft' by default.
Layout naming
Mikser's convention for layouts that need a postprocessor is <name>.<format>-<postprocessor>.<template>. Use the -mjml suffix to opt in:
| Layout file | Renderer output | Final output |
|---|---|---|
| welcome.html-mjml.hbs | MJML markup (rendered via HBS) | welcome.html |
| welcome.html-mjml.liquid | MJML markup (rendered via Liquid) | welcome.html |
The renderer's job is to produce MJML markup; the format segment (html above) is mostly a no-op for naming. The plugin reads the rendered file, compiles MJML → HTML, and writes the result to <name>.html.
Why not just welcome.mjml.hbs?
Without the -mjml postprocessor suffix, Mikser treats the rendered output as the final file (welcome.mjml) — no compilation happens. The suffix is what hooks the postprocessor into the pipeline.
Example layout
<mjml>
<mj-body>
<mj-section>
<mj-column>
<mj-text font-size="20px">{{document.meta.title}}</mj-text>
<mj-text>{{document.meta.body}}</mj-text>
</mj-column>
</mj-section>
</mj-body>
</mjml>MJML validation errors (if any) are surfaced via the Mikser logger as warnings.
License
MIT
