Developers4 min read•Audience: Developers
MJML Export
Export clean, semantic MJML source code for developer automation, version control, and CI/CD pipelines.
Key Takeaways
- Export the underlying MJML markup generated from your visual canvas.
- MJML source is human-readable, concise, and ideal for version control in Git repositories.
- Compile locally using the official @mjml CLI or node package.
- Easily customize or extend with custom mj-raw blocks and head styles.
When to Use MJML Export#
While marketing teams typically export HTML directly into their ESP, engineering teams frequently prefer raw MJML:
- Git Version Control: An MJML document is 100–200 lines of clean XML, whereas compiled HTML is 1,500+ lines of table boilerplate. Storing MJML in your Git repo makes code reviews and diffs easy to read.
- Custom Post-Processing: If you have a custom build script that inlines specific localized strings or adds dynamic tracking wrappers, compiling MJML as the final step in your build pipeline gives you total control.
Compiling MJML Locally with Node.js#
You can compile exported MJML using the official open-source compiler:
code
bash
Or programmatically in a Node.js microservice:
code
typescript
Frequently Asked Questions
Is PostBrix MJML 100% compliant with standard MJML 4?
Yes. PostBrix adheres strictly to the official MJML specification and validates all generated tags prior to export.
Can I import an existing MJML file into PostBrix?
Yes. PostBrix includes an MJML importer that parses valid MJML tags into the visual canvas block AST.