Client-side templating language with java compiler as well (DRY templating)

狂风中的少年 提交于 2019-11-28 21:38:56
Geert-Jan

I'm going for Mustache for now and anticipating a java implementation for Handlebars.js. Once that exists, the refactoring-path shouldn't be that steep.

EDIT - april 2012

Ok, updating this for future reference:

  • I'm outsourcing server-side templating to Node.js.
  • communication between java and node.js implemented using sockets. (see: Sending data from node.js to Java using sockets for where I got the idea)
  • Since now I only need a client-lib (or better one that runs in javascript on both client and server-side using node) I can choose more freely. Having become accustomed to Mustache, I've chosen the Hogan parser (by the Twitter guys) ( http://twitter.github.com/hogan.js/ )

100% DRY (even the client-side mixins and i18N-bundles come from the same source. Moreover, Hogan can precompile the templates server-side and open a connection to the client so the client doesn't have to parse the template anymore on first connect.

Is it fast? Lightning...

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!