Template

Mole~Peripherals~ Template

Creates a new user defined template

Constructor

new Template(name, func) → {Object}

Source:
Parameters:
Name Type Description
name string

Name of the template

func Mole.Peripherals.Template~function | string

A callback that returns a string for the template

Returns:
Type:
Object

An object with a name, a func, and an optional output property

Example
// Example while exporting as module
import Template from 'mole'

export default new Template('template-name', function(model) {
		return // The string you'd like to return to be parsed
	})
)

Type Definitions

function(data, theme) → {String}

Callback for returning a template string

Source:
Parameters:
Name Type Description
data Object

Access to the data model

theme Object

Access the original theme data

Returns:
Type:
String

Returns a string which is rendered using a templating engine