templater
- Description:
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.
- Source:
Methods
(static) renderFile(filePath, data) → {String}
- Description:
Apply the template in the file with the given (virtual file-system) path to the given data object.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
filePath |
String | Path to template file. |
data |
Object | Object containing values to substitute into the template. |
Returns:
- Type
- String
(static) renderString(templateString, data) → {String}
- Description:
Apply the given template to the given data object.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
templateString |
String | String containing the template |
data |
Object | Object containing values to substitute into the template. |
Returns:
- Type
- String