Table of contents
Introduction
Hi there, as I needed a template engine for one of my customer, I looked around to find the one that was the best fitting my needs. My requirements where the following :
- Cross-browser
- Easy to learn
- Allow easy internationalization
- Library independent
- Well documented and maintained
- Possibility to add custom helpers and modifiers
- Process relies on a compilation (to avoid multiple compilation)
Well, let's see what's on the place.
State of art
Several client side templates engines are available, here are some that kept my attention :
The choice
I finally decided to use JST that seemed to be the one that best fits my needs. MModifiers are simple to declare and to use for variables modification (such as upper-case or html sanitize-ing), and macros seems to be the way to declare helpers.
For the Internationalization, as I am using JSON datas it seems to be a simple workaround that can be achieved using a little layer aver the templateObject.
An other point that kept my attention is that syntax is most likely the same as the Javascript one, and that's a good point not to have to learn a new syntax.
Last but not least, it is possible to use inline JavaScript statements.
Playing around
Here comes the interesting part, it's time for tests ;-)
I'll keep you in touch with further posts including some of my code, but for now, I'll just give the documentation link
No comments:
Post a Comment