splate
The simplest possible streaming JavaScript template engine that could possibly work. JavaScript in your HTML. Oh god it's ASP all over again.
Features
- Start JS code block with
<?js
- End JS code block with
?>
- Print with
<?js= "Hello World!" ?>
Usage
Template file ("template.html") looks like:
<?jsfor (var i = 0; i < 10; i++) {?><?js= "foo " + i ?><?js } ?>
Compile the template with splate:
var splate = fs = fs
"compiled-tpl.js" looks like:
{var str="";str+="<!doctype html>\n<html>\n<ul>\n";for var i = 0; i < 10; i++ ;str+="\n<li>";str+= "foo " + i ;str+="</li>\n"; ;str+="\n</ul>\n</html>";return str;}