MJML + Your favourite templating engine
Switch branches/tags
Nothing to show
Clone or download
Latest commit d36f1f7 Aug 10, 2017
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore Added README, moved debug code out of git Sep 28, 2016
LICENSE.md Add LICENSE Sep 28, 2016
README.md Update README.md Aug 10, 2017
index.js Render as string when supplying abs paths Feb 23, 2017
npm-debug.log Render as string when supplying abs paths Feb 23, 2017
package.json 0.1.2 Sep 28, 2016

README.md


MJML + Your favourite templating engine

Experimental

This project is still in early development. Proceed with caution, breaking changes will be coming

Only tested with nunjucks

Installation

npm install mailplate -s

Usage

var Mailplate = require('mailplate');
var nunjucks = require('nunjucks');

var mailplate = new Mailplate({
  renderer: nunjucks
});

mailplate.render('./hello.nunj', {
  name: 'World',
}, function(err, result){
  console.log(err, result);
});

hello.nunj

<mjml>
  <mj-body>
    <mj-container>
      <mj-section>
        <mj-column>
          <mj-text align="center">
            Hello {{ name }}!
          </mj-text>
        </mj-column>
      </mj-section>
    </mj-container>
  </mj-body>
</mjml>

Caveats

  • You cannot use <mj-include path="template.mjml"> instead use your template engines include function in nunjucks this is {% include "template.html" %}