manage-postmark-mjml-templates-cli v1.0.9
MANAGE MJPM (MJML + POSTMARK)
Basically it follows this folder structure:
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