/NUTS

Nearly Useless Template System

Primary LanguageJavaScriptMIT LicenseMIT

Build Status Codacy Badge Code Climate bitHound Score

NUTS

Nearly Useless Template System

NUTS is a nearly useless templating system for Javascript.

How to use it

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!