统一的 HTML 模板语言
似乎每个 Web 框架都有自己的宠物模板语言。 Ruby 有 eRuby,Python 的 django 使用 Django 模板语言< /a>,Haskell 有 Heist 和 哈姆雷特,Java 有 JSP,然后是 PHP...
我的问题是,有人尝试过创建一种模板语言来统治它们吗?是否有这样的模板语言至少在不同的 Web 框架中得到了一些的广泛支持?
It seems like every web framework has its own pet template language. Ruby has eRuby, Python's django uses the Django template language, Haskell has Heist and Hamlet, Java's got JSP, and then there's PHP...
My question is, has anyone tried creating One Templating Language to Rule Them All? Are there any such templating languages that at least have some widespread support amongst the varying web frameworks?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
小胡子 也许吧。
Mustache maybe.
XSLT 可能是“通用”模板语言的候选者。
这也可能是这片土地上所见过的最大的邪恶,但这还有待商榷。
XSLT might be a candidate as a "universal" template language.
It might also be the greatest evil that this land has ever seen, but that's up for debate.
NHAML/HAML 是最接近标准的。
NHAML/HAML is the closest you'll get to a standard.
Freemarker(以及Velocity 在某种程度上)似乎受到越来越多的框架(Spring、Tiles、Struts 和 more) 并可用于在任何框架中生成代码,但我不认为有“一个模板引擎来统治它们全部”。如果有的话,我随时都会选择 Freemarker
Freemarker (and Velocity to some extent) seem to be supported by a growing number of frameworks (Spring, Tiles, Struts and more) and can be used to generate code in any framework, but I don't think there is "one template engine to rule them all". If there was though, I would choose Freemarker any day
呃...尝试为 WEB 项目找到类似的东西,它能够从两侧的相同模板渲染 html。服务器和客户端。已经提到 Mustache 接缝是迄今为止最合适的选择...
也许 这个 基于 JSON 的解决方案听起来很有趣......
而且 HAML 看起来很有希望。
uh... Trying to find something like that for WEB project which would be able to render html from same templates at both sides. Server and Client. Already mentioned Mustache seams to be most suitable choice so far...
Maybe this JSON based solution will sound interesting...
Also HAML looks promising.