jSmart 是著名的 PHP 模板引擎 Smarty 的 JavaScript 移植版本。
示例模板:
<script id="test_tpl" type="text/x-jsmart-tmpl"> <h1>{$greeting}</h1> {foreach $books as $i => $book} <div style="background-color: {cycle values="cyan,yellow"};"> [{$i+1}] {$book.title|upper} by {$book.author} {if $book.price} Price: <span style="color:red">${$book.price}</span> {/if} </div> {foreachelse} No books {/foreach} Total: {$book@total} </script>