Sweet javascript template
Sweet (Simple WEb front-End Template) is a lightweight javascript template with high performance.
It"s small, fast, very easy to use, and, most important, extensible.
It also has been integrated with jQuery.
See the template html below:
// Not like many other template tools, I use <[...]> as delimiters, // but you can change delimiters to what you prefer by a little method...var tpl = "
" // Here"s two control flow, you can use any javascript expression in the template inline code + "<[foreach ($data as item) { if (item.showMe) { ]>" // <[= value ]> is the assignment statement + "- <[= item.name ]>
" + "<[ } } ]>" + "
";
Now we have a json data:
var data = [{showMe: true, name: "Jerry"}, {showMe: false, name: "Mark"}, {showMe: true, name: "Scotti"}, {showMe: true, name: "Carol"}, {show