JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 16
  • Score
    100M100P100Q38278F
  • License ISC

Automagically compile MJML templates to responsive HTML and easily update new versions to Sendwithus platform

Package Exports

  • swu-mjml

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (swu-mjml) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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-KEY header key (you can find your API key in Sendwithus api settings)
  • Make GET request to https://api.sendwithus.com/api/v1/templates URL

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_src path in config object.
  • Make sure that templates settings matches mjml_src folder structure.

Running demo app

  • Run npm start to compile lib directory from source
  • Run node demo.js
By default
  • use localhost:3001 to list all local templates
  • use localhost:3001/swu-templates to get response from sendwithus API about all templates and their versions

Testing

npm test