MeccaMedialight / tashwax

Helper for using Moustache templates

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

Helper for using Moustache templates

License:GNU General Public License v3.0


Languages

Language:JavaScript 100.0%