Reputation: 9361
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
Unsatisfactory solutions found so far
Upvotes: 24
Views: 7321
Reputation: 9361
We ended up picking dust.js. Check out Leaving JSPs in the dust and The client-side templating throwdown for more info.
Upvotes: 1
Reputation: 169383
Use EJS. It's pretty much got all the features you ask.
It can be used with express.js out of the box and it works nicely on the client.
As a bonus I would use backbone.js to do MVC on the client & server.
Of course this does rely on node.js. I feel that using express, now & backbone allows you a lot of stable control with node.js. Not to mention that SSJS is simply awesome and that code re-use is fantastic.
Upvotes: 3
Reputation: 1026
I would opt for XSLT (http://www.w3schools.com/xsl/xsl_client.asp)
Upvotes: -1