Logicless templating for jQuery using Mustache like markup & syntax.
JavaScript
Pull request Compare This branch is 21 commits ahead, 114 commits behind BorisMoore:gh-pages.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
README.md
index.html
jquery.tpl.js

README.md

Light & logicless templating for jQuery using Mustache like markup & syntax.

@see http://mustache.github.com/mustache.5.html for markup & syntax.

@todo Write real doc.

// Append one Item
$( '#litpl' )
    .tpl( object )
    .appendTo( 'ul' );
// Or
$( 'ul' ).append( '#litpl', object );

// Append multiple Items
$( '#litpl' )
    .tpl( arrayOfObjects )
    .appendTo( 'ul' );
//Or
$( 'ul' ).append( '#litpl', arrayOfObjects );

with html like:

<ul></ul>

<script id="litpl" type="text/html">
<li><b>{{property}}</b></li>
</script>
  • Support n based index with {{*n}} tag (get index of array of data)
  • Don't support delimiter's change, but you can escape delimiters ( {%{% & %}%} respectively)
  • Don't support nested {{#blocks}} with same names (and won't support it as I use regex and not state machine)