API Docs for:
Show:

templater Class

Module: API

Templater provides template services, and is accessed via the global variable 'templater'. It supports Mustache-style template syntax as documented here and is a very simple ('logic-less') system for generating text from templates and Javascript data-objects. The basic idea is that the template should contain macros like '{{firstName}}' which match the names of properties of the given Javascript object. This will result in the value of the property being substituted into the template.

Item Index

Methods

renderFile

(
  • filePath
  • data
)
String

Apply the template in the file with the given (virtual file-system) path to the given data object.

Parameters:

  • filePath String

    Path to template file.

  • data Object

    Object containing values to substitute into the template.

Returns:

String:

renderString

(
  • templateString
  • data
)
String

Apply the given template to the given data object.

Parameters:

  • templateString String

    String containing the template

  • data Object

    Object containing values to substitute into the template.

Returns:

String: