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
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.
We ended up picking dust.js . Check out Leaving JSPs in the dust and The client-side templating throwdown for more info.
我会选择XSLT( http://www.w3schools.com/xsl/xsl_client.asp )
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.