cxTemplate

cxTemplate

Use templates in the system and compile them with your variables

Example

const cxTemplate = require('cxTemplate');
async function main(data) {
  let { html } = await cxTemplate.compile('myCustomPage', {name: 'Joe Blogs'});
  return html;
}

Methods

(static) compile(name, vars) → {Promise}

Source:

Build Template from Variables

Example
var { text, html, sms, subject } = await cxTemplate.compile('alert', {name: 'Joe Blogs'});
Parameters:
Name Type Description
name string

Template Name

vars object

Variables to inject into template

Returns:
Type
Promise