jsutils / tmpl
Javascript Templating engine taken from underscore
Installs: 87
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 4
Forks: 1
Open Issues: 0
Language:JavaScript
Requires
- webmodules/foo: >=3.0.0
README
_if
<_if exp="data.value==34"> It is 34 <_elseif exp="data.value==40" /> it is 45 <_else/> I dont know </_if>
_for
<_for exp="var i=0;i<10;i++"> <span>for{{i}}</span> </_for>
_forEach
<_forEach var key value in data> <span>{{key}}=={{value}}</span> </_forEach> <_forEach var key in data> <span>{{key}}=={{data[key]}}</span> </_forEach>
_tags
<_tags jq-label jq-switch/>
custom tags to be used in current template, can be configured by method jsutils.tmpl.tags
jsutils.tmpl.tags(function(tagName){ if(tagName.indexOf("jq-")===0){ module(tag.replace("jq-","jqtags.")); return true; } else { return false; } });
You can create your own directives
jsutils.tmpl.tags(function(tagName){ if(tagName.indexOf("jq-")===0){ module(tag.replace("jq-","jqtags.")); return true; } else { return false; } });