jsutils/tmpl

Javascript Templating engine taken from underscore

Maintainers

Details

github.com/jsutils/tmpl

Source

Issues

Installs: 87

Dependents: 1

Suggesters: 0

Security: 0

Stars: 0

Watchers: 4

Forks: 1

Open Issues: 0

Language:JavaScript

0.0.10 2017-04-18 18:05 UTC

This package is not auto-updated.

Last update: 2024-12-21 20:24:47 UTC


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;
    }
});