Nearly Useless Template System
NUTS is a nearly useless templating system for Javascript.
NUTS is simple to use.
First, create a template:
var template = '<div>[:text]</div>';
Then, render it, by passing an object of values:
var obj = {
text: "Hello world!"
};
var html = nuts(template, obj);
Your context object can also contain functions...
var userTemplate = '<div>Full name is: [:name]</div>',
userModel = {
"firstName": "Fred",
"lastName": "Flintstone",
"name": function() {
return this.firstName + ' ' + this.lastName;
}
},
html = nuts(userTemplate, userModel);;
That's it!