Skip to content
jQuery.tpl without jQuery
JavaScript
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
.gitignore
README.rdoc
index.html
jquery.js
jsTPL.block.js
jsTPL.filter.js
jsTPL.js
test.html

README.rdoc

jsTPL project: simple, fast and powerfull templates for javascript and jQuery(github.com/donnerjack13589/jQuery.tpl).

It's easy to learn - start now!

Basic examples:

jsTPL(“1 + 1 = {%= 1+1 %}”)(); // 1 + 1 = 2 jsTPL(“Hello {%= a %}!”,[“a”]) ({a: 'World'}); // >> Hello World! jsTPL(“Hello {%each a%}{%= this %}, {%/each%}world!”,[“a”]) ({a: ['Andy','Alex']}); // >> Hello Andy, Alex, World! jsTPL(“{%if godmode%}My Lord!{%else%}Who are you?{%/if%}”,[“godmode”]) ({godmode: true}); // >> My Lord!

Medium examples:

jsTPL(“{%catch var a %}What's up, dude?{%/catch%} {%= a.substr(0,9) %}?”)(); // >> What's up? jsTPL(“{%~ var a = true; %}{%if !a %}'a' is false?{%/if%}”,[“a”])(); // >> 'a' is false? jsTPL(“{%@ name(value) { return '~' + value + '~' } %}{%= name('fancy')%}”)() // >>~fancy~

Block module

jsTPL(“<div>Hello, {%block 'username'%}{%/block%}!</div>”,[],“block”); jsTPL(“{%extends 'block'%}{%block 'username'%}Admin{%/block%}”)().html(); // >> Hello, Admin!

Something went wrong with that request. Please try again.