manage-postmark-mjml-templates-cli
v1.0.9
Published
A basic utility tool to manage postmark templates with MJML
Downloads
1
Readme
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:
- The CLI tool is dependent on
mjml
andpostmark-cli
, if these packages are not installed the cli tool will try to install them or will fail to run. - 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