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
Compiling and Rendering Templates with Stud
var stud = require('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>";
var compiledTmpl = stud.compile(tmpl,'template_reg_name');
eval(compiledTmpl);
stud.render('template_reg_name', data, function(rendered){
console.log(rendered);
});
Usage in Browser
Compiling and Rendering Templates with Stud
<script src='path/to/stud.js'></script>
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>";
var compiledTmpl = stud.compile(tmpl,'template_reg_name');
eval(compiledTmpl);
stud.render('template_reg_name', data, function(rendered){
console.log(rendered);
});
That is all to it. Have fun compiling and rendering with Stud
.