mustache

Mustache template related functions.

Example
var mustacheLib = require('/lib/xp/mustache');

Methods

(static) render(view, model) → {string}

This function renders a view using mustache.

Parameters:
Name Type Description
view

Location of the view. Use resolve(..) to resolve a view.

model object

Model that is passed to the view.

Returns:

The rendered output.

Type
string
Example
var view = resolve('view/fruit.html');
var model = {
    fruits: [
        {
            name: 'Apple',
            color: 'Red'
        },
        {
            name: 'Pear',
            color: 'Green'
        }
    ]
};

var result = mustacheLib.render(view, model);