HomeBlogYet Another JavaScript Template Engine

Yet Another JavaScript Template Engine

I had to do this. :-)

I mean, I don't like any existing template systems.

I don't like mine either.  But still I think it's better than others.  I was looking at Tenjin and they have something like this:

<?js for (var i = 0; i < list.length; ++i) { ?>
<?js     var el = list[i] ?>
<?js } ?>

Functional, maybe, but downright ugly.  In YAJET, we can write it like this:

$(FOREACH (el => list)  <li>$el</li>  $)

which I think is a lot better.  YAJET compiles the templates into JavaScript code, so for your template you get a function that runs blazing fast.  It tries hard to do this The Right Way, so you don't have weird variable name clashes, or side effects.

Give it a try.  There's a jQuery plugin too, for those who can't live without jQuery. :-)


Page info
2010/05/30 20:54
2010/05/30 20:57
Mihai Bazon
javascript, programming
See also