1.0.0 • Published 4 years ago
@luke-mml/tashwax v1.0.0
Tashwax
Helper module for using Mustache templates. Designed to work with require.js.
Demo
Example use:
var tash = require('tashwax'), data;
tash.loadAndRender('./templates/template.html', data, $('#test'));
This will load a template from /templates/template.html, and render this to html using the data object, inserting the result in the element #test. When a template is loaded, it will be stashed in memory (to avoid having to make another request)
Example use:
tash.loadTemplate('./templates/template.html', function(tpl, src){
$target.html(Mustache.render(tpl, data));
});
This will load a template from /templates/template.html. A callback function will then use Mustache to render the result into the target element
1.0.0
4 years ago