MailTemplate

An implementation of a parser for assembling email bodies.

Available:

  • Handlebars

  • Fake

Methods:

Compile: Processes the .hbs file, replacing variables in the template with the values provided.

<h3>It's a pleasure to have you here {{description}}</h3>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Greeting</title>
</head>
<body>
  <h1>Hello {{name}}</h1>
  {{> component}}
</body>
</html>
const content = this.mailTemplateProvider.compile({
  file: resolve('..', 'file.hbs'),
  variables: { name: 'your name' },
  partials: [
    {
      name: 'component',
      file: resolve('..', 'component.hbs'),
      variables: { description: 'in the CLI documentation' },
    }
  ],
});

Last updated

Was this helpful?