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] ?>
     <li>#{el}</li>
<?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. :-)

Comments — add your comment

(not published)
    
Notes
  • We don't publish your email address. It's only useful if you wish to receive a notification when someone replies to your comment.

  • Notifications work by thread. That is, you'll be notified even if someone replies to a reply to one of your comments.

  • Each notification includes a "remove me" link that removes your notification option from that comment forever.

  • If you want to reply a certain comment, be sure to click the "reply to this comment" link into it (will automatically setup threads).

Page info
Created:
2010/05/30 20:54
Modified:
2010/05/30 20:57
Author:
Mihai Bazon
Comments:
5 (add yours)
Tags:
javascript, programming
See also