18,289
stars
+7+5+36
1,009
forks
–
watchers
–
prs
–
issues
–
releases
–
discussions
README
Developed by
---
| Introduction
| Installation
| Usage |
---
Introduction
MJML is a markup language created by Mailjet and designed to reduce the pain of coding a responsive email. Its semantic syntax makes the language easy and straightforward while its rich standard components library shortens your development time and lightens your email codebase. MJML’s open-source engine takes care of translating the MJML you wrote into responsive HTML.
Installation
You can install MJML with NPM to use it with NodeJS or the Command Line Interface. If you're not sure what those are, head over to Usage for other ways to use MJML.
bash
npm install mjml
Development
To work on MJML, make changes and create pull requests, download and install yarn for easy development.
bash
git clone https://github.com/mjmlio/mjml.git && cd mjml
yarn
yarn build
You can also run yarn build:watch to rebuild the package as you code.
Usage
Online
Don't want to install anything? Use the free online editor!
Applications and plugins
MJML comes with tools and plugins, check out:
- Visual Studio Code plugin (MJML is included). Also available at Visual Studio Code Marketplace and the Open VSX Registry or in the extensions tab of the Visual Studio Code app.
- Sublime Text plugin (MJML needs to be installed separately)
For more tools, check the Community page.
Command line interface
Compiles the file and outputs the HTML generated in output.html
bash
mjml input.mjml -o output.html
You can pass optional arguments to the CLI and combine them.
| argument | description | default value |
| -------------------------------- | ------------------------------------------------------ | ------------- |
| mjml [input] -o [output] | Writes the output to [output] | |
| mjml [input] -s | Writes the output to stdout | |
| mjml [input] -s --noStdoutFileComment | Writes the output to stdout without file comment in the first line | |
| mjml -w [input] | Watches the changes made to [input] (file or folder) | |
| mjml [input] --config.allowIncludes | Enables mj-include processing (true or false) | false |
| mjml [input] --config.allowMixedSyntax | Allows mixing block and CSS variable syntax when sanitizeStyles is enabled (true or false) | false |
| mjml [input] --config.beautify | Beautifies the output (true or false) | true |
| mjml [input] --config.includePath | Adds allowlisted include root(s), as a string path or JSON array of paths | |
| mjml [input] --config.minify | Minifies the output (true or false) | false |
| mjml [input] --config.minifyOptions | Options for HTML minifier, use minifyCss to control CSS minification | See mjml-cli documentation |
| mjml [