mjml
MJML: the only framework that makes responsive-email easy
Last updated a month ago by kmcb .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install mjml 
SYNC missed versions from official npm registry.

MJML 4

travis

| Introduction | Installation | Usage | Contribute |


Introduction

MJML is a markup language created by Mailjet and designed to reduce the pain of coding a responsive email. Its semantic syntax makes it easy and straightforward while its rich standard components library fastens 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.

npm install mjml

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 HTML See in index.js
keepComments boolean Option to keep comments in the HTML output true
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 config attribute from .mjmlconfig file false

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.

Current Tags

  • 3.3.3-beta.3                                ...           beta (3 years ago)
  • 4.6.3-alpha.0                                ...           experimental (2 months ago)
  • 0.0.1-future                                ...           future (3 years ago)
  • 4.6.3                                ...           latest (a month ago)
  • 4.7.0-beta.1                                ...           next (7 days ago)

134 Versions

  • 4.7.0-beta.1                                ...           7 days ago
  • 4.7.0-beta.0                                ...           9 days ago
  • 4.6.3                                ...           a month ago
  • 4.6.3-alpha.0                                ...           2 months ago
  • 4.6.2                                ...           3 months ago
  • 4.6.1                                ...           3 months ago
  • 4.6.0                                ...           3 months ago
  • 4.5.1                                ...           8 months ago
  • 4.5.0                                ...           9 months ago
  • 4.4.1                                ...           10 months ago
  • 4.4.0                                ...           a year ago
  • 4.4.0-beta.3                                ...           a year ago
  • 4.4.0-beta.2                                ...           a year ago
  • 4.4.0-beta.1                                ...           a year ago
  • 4.3.1                                ...           a year ago
  • 4.3.0                                ...           a year ago
  • 4.2.1                                ...           2 years ago
  • 4.2.0                                ...           2 years ago
  • 4.2.0-beta.3                                ...           2 years ago
  • 4.2.0-beta.2                                ...           2 years ago
  • 4.2.0-beta.1                                ...           2 years ago
  • 4.1.2                                ...           2 years ago
  • 4.1.1                                ...           2 years ago
  • 4.1.0                                ...           2 years ago
  • 4.1.0-beta.4                                ...           2 years ago
  • 4.1.0-beta.3                                ...           2 years ago
  • 4.1.0-beta.2                                ...           2 years ago
  • 4.1.0-beta.1                                ...           2 years ago
  • 4.0.5                                ...           2 years ago
  • 4.0.4                                ...           2 years ago
  • 4.0.3                                ...           2 years ago
  • 4.0.2                                ...           2 years ago
  • 4.0.1                                ...           2 years ago
  • 4.0.0                                ...           2 years ago
  • 4.0.0-beta.2                                ...           2 years ago
  • 4.0.0-beta.1                                ...           2 years ago
  • 4.0.0-alpha.5                                ...           3 years ago
  • 4.0.0-alpha.4                                ...           3 years ago
  • 3.3.5                                ...           3 years ago
  • 3.3.4                                ...           3 years ago
  • 4.0.0-alpha.3                                ...           3 years ago
  • 3.3.3                                ...           3 years ago
  • 4.0.0-alpha.2                                ...           3 years ago
  • 4.0.0-alpha.1                                ...           3 years ago
  • 3.3.3-beta.3                                ...           3 years ago
  • 3.3.3-beta.1                                ...           3 years ago
  • 3.3.2                                ...           3 years ago
  • 3.3.1                                ...           3 years ago
  • 0.0.1-future                                ...           3 years ago
  • 3.3.0                                ...           3 years ago
  • 3.3.0-beta.8                                ...           3 years ago
  • 3.3.0-beta.7                                ...           3 years ago
  • 3.3.0-beta.6                                ...           3 years ago
  • 3.3.0-beta.5                                ...           3 years ago
  • 3.3.0-beta.4                                ...           3 years ago
  • 3.3.0-beta.3                                ...           3 years ago
  • 3.3.0-beta.2                                ...           3 years ago
  • 3.3.0-beta.1                                ...           3 years ago
  • 3.2.2                                ...           3 years ago
  • 3.2.1                                ...           3 years ago
  • 3.2.0                                ...           3 years ago
  • 3.2.0-beta.3                                ...           3 years ago
  • 3.2.0-beta.2                                ...           3 years ago
  • 3.2.0-beta.1                                ...           3 years ago
  • 3.1.1                                ...           3 years ago
  • 3.1.0                                ...           3 years ago
  • 3.1.0-beta.2                                ...           4 years ago
  • 3.1.0-beta.1                                ...           4 years ago
  • 3.0.2                                ...           4 years ago
  • 3.0.1                                ...           4 years ago
  • 3.0.0                                ...           4 years ago
  • 3.0.0-beta.3                                ...           4 years ago
  • 3.0.0-beta.2                                ...           4 years ago
  • 3.0.0-beta.1                                ...           4 years ago
  • 2.3.3                                ...           4 years ago
  • 2.3.2                                ...           4 years ago
  • 2.3.1                                ...           4 years ago
  • 2.3.0                                ...           4 years ago
  • 2.3.0-beta.7                                ...           4 years ago
  • 2.3.0-beta.6                                ...           4 years ago
  • 2.3.0-beta.5                                ...           4 years ago
  • 2.3.0-beta.4                                ...           4 years ago
  • 2.3.0-beta.3                                ...           4 years ago
  • 2.3.0-beta.2                                ...           4 years ago
  • 2.3.0-beta.1                                ...           4 years ago
  • 2.2.0                                ...           4 years ago
  • 2.1.5-beta.1                                ...           4 years ago
  • 2.1.4                                ...           4 years ago
  • 2.1.4-beta.2                                ...           4 years ago
  • 2.1.4-beta.1                                ...           4 years ago
  • 2.1.3                                ...           4 years ago
  • 2.1.1                                ...           4 years ago
  • 2.1.0                                ...           4 years ago
  • 2.1.0-beta.5                                ...           4 years ago
  • 2.1.0-beta.4                                ...           4 years ago
  • 2.1.0-beta.3                                ...           4 years ago
  • 2.1.0-beta.2                                ...           4 years ago
  • 2.1.0-beta.1                                ...           4 years ago
  • 2.0.3                                ...           4 years ago
  • 2.0.2                                ...           4 years ago
  • 2.0.1                                ...           4 years ago
  • 2.0.0                                ...           4 years ago
  • 2.0.0-beta.6                                ...           4 years ago
  • 2.0.0-beta.5                                ...           4 years ago
  • 1.3.4                                ...           4 years ago
  • 2.0.0-beta.4                                ...           4 years ago
  • 1.3.4-beta.3                                ...           4 years ago
  • 1.3.4-beta.2                                ...           4 years ago
  • 1.3.4-beta.1                                ...           4 years ago
  • 2.0.0-beta.3                                ...           4 years ago
  • 1.3.3                                ...           4 years ago
  • 1.3.2                                ...           4 years ago
  • 1.3.1                                ...           4 years ago
  • 1.3.0                                ...           4 years ago
  • 1.3.0-beta.9                                ...           4 years ago
  • 1.3.0-beta9                                ...           4 years ago
  • 1.3.0-beta8                                ...           4 years ago
  • 1.3.0-beta7                                ...           4 years ago
  • 1.3.0-beta6                                ...           4 years ago
  • 1.3.0-beta5                                ...           4 years ago
  • 1.3.0-beta4                                ...           4 years ago
  • 1.3.0-beta3                                ...           4 years ago
  • 1.3.0-beta                                ...           4 years ago
  • 1.2.1                                ...           4 years ago
  • 1.2.0                                ...           4 years ago
  • 1.1.0                                ...           4 years ago
  • 1.0.4                                ...           4 years ago
  • 1.0.3                                ...           4 years ago
  • 1.0.2                                ...           4 years ago
  • 1.0.1                                ...           4 years ago
  • 1.0.0                                ...           4 years ago
  • 0.1.0                                ...           4 years ago
  • 0.0.2                                ...           4 years ago
  • 0.0.1                                ...           4 years ago
Downloads
Today 1
This Week 22
This Month 22
Last Day 1
Last Week 89
Last Month 274
Dev Dependencies (2)
Dependents (172)

Copyright 2014 - 2016 © taobao.org |