Minimalist, Tiny Javascript Template System?

I am looking for a minimalist template system for javascript, ala John Resig Javascript Micro Templating . The smaller the better, and if jquery works even better. Recommendations?

I tried John micro-templating, but ran into a few problems, wanted to see if there were more baked / better packaged solutions there.

[Update] I tried Resig Micro Templating again and it works great for me. I would like to know about other alternatives, if any.

+7
javascript jquery templates
source share
6 answers

In the end I went with the John Resig Micro Template, it works great for me.

-3
source share

There is also Mustache.js , it has neat IMO syntax.

+5
source share

This one is nice and tiny (400bytes gzipped or 600bytes minified). Also has attractive syntax {{hello}} , not the syntax <?php hideous ?> <% Whats-the-point-might-as-well-not-bother-with-templates%>

https://github.com/jasonmoo/t.js

A little more, but still very good (personally, only a mustache checked):

https://github.com/janl/mustache.js

http://tempojs.com/

https://github.com/premasagar/tim (370 bytes for the 'tinytim' version)

+3
source share

Theres JBST

 <a class="ExtLink" href="<%= "http://en.wikipedia.org/wiki/" + this.data.wiki %>" onclick="window.open(this.href);return false;"><%= this.data.name %></a> 
+1
source share

JBST (JsonML + Browser-Side Templating) is a good alternative to John Resig's Micro Template. It has a similar syntax, but the parsing of templates is not performed at runtime, so it can be more compact and reliable. The result of the parsing is pure JavaScript, which can be combined with other scripts and executed directly in the browser.

UPDATE: this system was rewritten from scratch as a template library with duel support (client and server) called DUEL: http://duelengine.org

+1
source share

I really like JST (JavaScript Templates) . They use the same convention for tokens as JSPs $ {} - quite easily.

0
source share

All Articles