PUG Templates

Smartmate renders PUG templates using pug version 3.

PUG templates can be used by Smartmate to generate:

  • Emails

  • HTML files

  • PDF files

Using field values and variables

If you have used pug before, you already know that fields and variables should be written surrounded by curly braces and preceded by a number sign.

  • #{myField}

  • #{_vars.myVariable}

  • #{relationshipField.anotherField}

  • #{myTableField}


Let’s say that we want to send an email to a user when their vacations request has been approved. You could create the following template:

p Hi #{_vars.initiator.firstName}:
  span Your vacations request has been
  strong APPROVED
  span by
  strong #{manager.firstName} #{manager.lastName}

The email generated might look like this:

Hi John:

Your vacations request has been APPROVED by Jane Doe

Additional features

PUG is a powerful templating engine that supports a lot of additional features like:

  • Code (JS)

  • Conditionals

  • Filters

  • etc.

To learn more about pug, make sure you check the official pug documentation.