async-mustache

Asyncronous view functions


Keywords
mustache, template, async
License
MIT
Install
bower install async-mustache

Documentation

async-mustache.js Build Status

Asyncronous view functions

NPM

A wrapper around https://github.com/janl/mustache.js/ providing asyncronous view functions

Usage

Node:

var Mustache = require('mustache');
var AsyncMustache = require('async-mustache')({mustache: Mustache});

var view = {
	async: AsyncMustache.async(function (text, render, callback) {
		setTimeout(function () {
			callback(null, render(text));
		}, 0);
	}))
};

AsyncMustache.render('{{#async}}async-{{/async}}mustache.js', view).then(function (output) {
	console.log(output); // async-mustache.js
});

Browser:

<script src="mustache.js"></script>
<script src="async-mustache.js"></script>
<script>
var asyncMustache = require('async-mustache')({mustache: Mustache});
//Use it
</script>

LICENSE

MIT