Stud
A very simple and fast template engine for compiling and rendering pre-compiled HTML templates in an unopinionated fashion.
Installation
npm install stud
Installation
npm test
Usage in Node
Stud
Compiling and Rendering Templates with var stud = data = name:'steve' age:23 location:'US' tmpl = "<td class='{name}'> {name} - {age} some of them are useful at location {location} as specified in the docs.</td>"; /*The template will be registered with the name 'template_reg_name' */ var compiledTmpl = stud; ; /* * Alternatively, assynchronously var = stud.compile(tmpl,'template_reg_name', function(compiledTmpl){ eval(compiledTmpl); }); */ stud; /* Alternatively,synchronously var rendered = stud.render('template_reg_name', data); console.log(rendered); */
Usage in Browser
Stud
Compiling and Rendering Templates with <!-- Include a copy of stud.js in the head section of your page -->
/* You stud in the global object, window in this case */ var data = name:'steve' age:23 location:'US' tmpl = "<td class='{name}'> {name} - {age} some of them are useful at location {location} as specified in the docs.</td>"; /*The template will be registered with the name 'template_reg_name' */ var compiledTmpl = stud; ; stud;
That is all to it. Have fun compiling and rendering with Stud
.