swu-mjml v1.1.0
swu-mjml
Automagically compile MJML templates to responsive HTML and easily update new versions to Sendwithus platform
Slack: https://join.slack.com/t/swu-mjml/signup

MJML
This package compiles MJML templates to responsive HTML email templates.
MJML is a markup language designed to reduce the pain of coding a responsive email. Its semantic syntax makes it easy and straightforward and its rich standard components library speeds up your development time and lightens your email codebase. MJML's open-source engine generates high quality responsive HTML compliant with best practices. Read more about MJML
Sendwithus
This Package uses Sendwithus API to update templates
Sendwithus helps marketers ensure their transactional and triggered emails are awesome, with template management, testing, and analytics Read more about Sendwithus
If you want to get all templates with their versions, you have to make a GET request to api.sendwithus.com.
- Set
X-SWU-API-KEYheader key (you can find your API key in Sendwithus api settings) - Make
GETrequest tohttps://api.sendwithus.com/api/v1/templatesURL
Installation
npm install swu-mjml
API
Create configuration and templates settings
var config = {
swu_api_key: 'test_xxx',
path: 'test/templates',
mjml_src: 'test/mjml',
views_path: 'test/views/index',
port: 3001
};
var mjml_templates = {
example1: {
racoon1: { id: 'tem_xxx', version: 'ver_xxx' },
racoon2: { id: 'tem_xxx', version: 'ver_xxx' }
},
example2: {
racoon1: { id: 'tem_xxx', version: 'ver_xxx' }
}
}Start swu-mjml
var swu_mjml = require('swu-mjml')(config, mjml_templates);
swu_mjml.start()- You have correctly define
mjml_srcpath inconfigobject. - Make sure that templates settings matches
mjml_srcfolder structure.
Running demo app
- Run
npm startto compilelibdirectory from source - Run
node demo.js
By default
- use
localhost:3001to list all local templates - use
localhost:3001/swu-templatesto get response from sendwithus API about all templates and their versions
Testing
npm test