manage-postmark-mjml-templates-cli

1.0.9 • Public • Published

MANAGE MJPM (MJML + POSTMARK)

A Basic CLI tool for managing templates when working wth MJML and Postmark.

The CLI tool looks for a folder named "PMA", and inside PMA folder it looks for templates

Basically it follows this folder structure:

Screenshot 2022-12-24 at 1 39 35 AM

It will detect templated folders inside PMA folder, How? It will search "index.mjml" file since this file will be used to convert from MJML to HTML.

so as dislayed in the attached picture, there are 2 templates inside PMA folder, template1 and template2.

A template must have following files:

1. index.mjml
2. meta.json

Why? as described above the index.mjml file is used to convert from mjml to html, and meta.json will be used by postmark-cli

How does meta.json file look like? It totally depends on your template's configuration but here's how a basic template file may look like:

{
  "Name": "Template name",
  "Alias": "template-alias",
  "Subject": "Your template subject",
  "TemplateType": "Standard",
  "LayoutTemplate": null,
  "TestRenderModel": {
     key:"value"
  }
}

Side Note:

  1. The CLI tool is dependent on mjml and postmark-cli, if these packages are not installed the cli tool will try to install them or will fail to run.
  2. For deployment you need to setup your server token in .env file as follows:
// .env

PMA_STAGING= your_staging_server_token
PMA_PROD= your_production_server_token

in-case if you're not using two environment, just put the same token in both variables.

Usage

Please install it globally and after installation, type manage-mjpm in your command line to see a list of available commands.

$ manage-mjpm

  Commands:
    manage-mjpm mjmlToHTML <command> [options]  Converts all templates to HTMLs
    manage-mjpm deploy <command> [options] Converts all templates to HTML and deploy the converted html to postmark.

  Options:
    --version  Show version number

Installation

  • Install Node.js
  • $ npm i manage-postmark-mjml-templates-cli -g
  • $ manage-mjpm

Readme

Keywords

none

Package Sidebar

Install

npm i manage-postmark-mjml-templates-cli

Weekly Downloads

1

Version

1.0.9

License

ISC

Unpacked Size

14.6 kB

Total Files

9

Last publish

Collaborators

  • kashanhaider