sodajs
Version:
Light weight but powerful template engine for JavaScript.
30 lines (25 loc) • 592 B
HTML
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
</head>
<body>
<script src="../dist/soda.min.js"></script>
<script>
soda.filter('shortTitle', function(input, length){
return (input || '').substr(0, length);
});
var tpl = '\
<ul soda-repeat="item in list">\
<li class="title">\
{{item.title|shortTitle:10}}\
</li>\
</ul>'
document.body.innerHTML = soda(tpl,{ list : [
{title:'short'},
{title:'i am too long!'}
] })
</script>
</body>
</html>