I'm investigating JavaScript templates as a way to render our views. The goal is to be able to render client-side for users that have JavaScript enabled to to render the same templates/data server side for those users (and crawlers) that don't.
Requirements
- Client side rendering.
- Server side rendering (JVM support a nice-to-have).
- Reasonable support for loops, conditionals, text manipulation, partials, macros and extensions/plugins.
- Reasonably big/active community of users.
Unsatisfactory solutions found so far
- Mustache: supports server and client side rendering, big/active community, but the "logic-less" templates seem very restrictive and painful.
- Node.js plus underscore: JS templates like underscore provide all the template flexibility I need, but rendering them server-side using Node.js is VERY fragile. node.js is new and fairly unstable and its package management (exports...) requires lots of hacks for things to work properly.
- Google Closure Templates: these compile down to JS and Java and have a lot of the features I want. Unfortunately, browsing the Google groups, it looks like lots of basic features are missing (such as ability to loop over associative arrays) and the documentation for making your own plugins is very sparse and painful looking. Moreover, I can't tell who in the online community is using it, Google isn't accepting open source contributions for it, and they don't have the bandwidth to release new features.
- isotope: write templates in JS and use Johnson, a Ruby wrapper for the Mozilla SpiderMonkey JS runtime, to render those templates server side. Seems promising, but the project hasn't had commits in over 6 months.
- Liquid with Liquid.js: the Liquid templating language looks superb, but the liquid.js project seems to be untested (no testing in IE!), has no documentation, it's not clear if anyone uses it, and it hasn't been updated in a while.