No description
  • JavaScript 100%
Find a file
dependabot[bot] 3c8d076030
Some checks are pending
Build Documentation / buildDoc (push) Waiting to run
Mjml CI / build (16.x) (push) Waiting to run
Mjml CI / build (18.x) (push) Waiting to run
Mjml CI / build (20.x) (push) Waiting to run
Bump brace-expansion from 1.1.11 to 1.1.12 (#2956)
Bumps [brace-expansion](https://github.com/juliangruber/brace-expansion) from 1.1.11 to 1.1.12.
- [Release notes](https://github.com/juliangruber/brace-expansion/releases)
- [Commits](https://github.com/juliangruber/brace-expansion/compare/1.1.11...v1.1.12)

---
updated-dependencies:
- dependency-name: brace-expansion
  dependency-version: 1.1.12
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-06-17 10:56:30 +02:00
.github [UPDATE] Node version to match LTS 2024-01-29 14:29:35 +01:00
doc Add mjml-bar-chart presentation to documentation community components section (#2953) 2025-06-05 18:32:28 +02:00
packages Pass parent attributes to rawXML child components (#2922) 2024-12-03 16:00:03 +01:00
.editorconfig fixing http links which is throwing mixed content errors 2020-01-21 21:00:04 +00:00
.eslintignore fix: resolve some merge conflicts and eslint errors 2020-05-27 22:22:03 +02:00
.eslintrc Transpile lib for node 10 2020-11-03 15:02:47 +01:00
.gitignore gitignore & npmignore 2020-05-27 20:16:42 +02:00
.prettierignore yarn.lock 2017-10-02 18:12:16 +02:00
.prettierrc yarn.lock 2017-10-02 18:12:16 +02:00
babel.config.js Transpile classes 2021-02-23 16:06:21 +03:00
CONTRIBUTING.md update doc link 2020-11-12 16:26:54 +01:00
lerna.json v4.15.3 2024-02-05 11:06:39 +01:00
LICENSE.md Adding LICENSE 2016-02-04 22:27:50 +01:00
package.json [CHORE] Long overdue dep update 2024-01-29 14:29:35 +01:00
readme-ja.md Update description of useMjmlConfigOptions 2023-02-20 10:38:12 +01:00
README.md Update description of useMjmlConfigOptions 2023-02-20 10:38:12 +01:00
test.js [CHORE] Long overdue dep update 2024-01-29 14:29:35 +01:00
type.js Clean 2017-08-23 10:53:19 +02:00
yarn.lock Bump brace-expansion from 1.1.11 to 1.1.12 (#2956) 2025-06-17 10:56:30 +02:00

MJML 4

If you're looking for MJML 3.3.X check this branch

github actions

| Translated documentation | Introduction | Installation | Usage |


Translated documentation

Language Link for documentation
日本語 日本語ドキュメント

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. MJMLs 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.

npm install mjml

Development

To work on MJML, make changes and create merge requests, download and install yarn for easy development.

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!

try it live


Applications and plugins

MJML comes with an ecosystem of tools and plugins, check out:

For more tools, check the Community page.

Command line interface

Compiles the file and outputs the HTML generated in output.html

mjml input.mjml -o output.html

You can pass optional arguments to the CLI and combine them.

argument description default value
mjml -m [input] Migrates a v3 MJML file to the v4 syntax NA
mjml [input] -o [output] Writes the output to [output] NA
mjml [input] -s Writes the output to stdout NA
mjml -w [input] Watches the changes made to [input] (file or folder) NA
mjml [input] --config.beautify Beautifies the output (true or false) true
mjml [input] --config.minify Minifies the output (true or false) false

See mjml-cli documentation for more information about config options.

Inside Node.js

import mjml2html from 'mjml'

/*
  Compile an mjml string
*/
const htmlOutput = mjml2html(`
  <mjml>
    <mj-body>
      <mj-section>
        <mj-column>
          <mj-text>
            Hello World!
          </mj-text>
        </mj-column>
      </mj-section>
    </mj-body>
  </mjml>
`, options)


/*
  Print the responsive HTML generated and MJML errors if any
*/
console.log(htmlOutput)

You can pass optional options as an object to the mjml2html function:

option unit description default value
fonts object Default fonts imported in the HTML rendered by MJML See in index.js
keepComments boolean Option to keep comments in the HTML output true
ignoreIncludes boolean Option to ignore mj-includes false
beautify boolean Option to beautify the HTML output false
minify boolean Option to minify the HTML output false
validationLevel string Available values for the validator: 'strict', 'soft', 'skip' 'soft'
filePath string Path of file, used for relative paths in mj-includes '.'
preprocessors array of functions Preprocessors applied to the xml before parsing. Input must be xml, not json. Functions must be (xml: string) => string []
juicePreserveTags Preserve some tags when inlining css, see mjml-cli documentation for more info NA
minifyOptions Options for html minifier, see mjml-cli documentation for more info NA
mjmlConfigPath string The path or directory of the .mjmlconfig file (for custom components use) process.cwd()
useMjmlConfigOptions Allows to use the options attribute from .mjmlconfig file false

Client-side (in browser)

var mjml2html = require('mjml-browser')

/*
  Compile a mjml string
*/
var htmlOutput = mjml2html(`
  <mjml>
    <mj-body>
      <mj-section>
        <mj-column>
          <mj-text>
            Hello World!
          </mj-text>
        </mj-column>
      </mj-section>
    </mj-body>
  </mjml>
`, options)


/*
  Print the responsive HTML generated and MJML errors if any
*/
console.log(htmlOutput)

API

A free-to-use MJML API is available to make it easy to integrate MJML in your application. Head over here to learn more about the API.

MJML Slack

MJML wouldn't be as cool without its amazing community. Head over the Community Slack to meet fellow MJML'ers.

Contributors