目前最好的 Javascript 模板引擎是什么?
因此,关于这个主题有很多较旧的问题,它们指出了许多可用的选项。例如,以下两个问题是该主题中回答最多的一些问题:
这两个问题的大部分答案是从 2008 年开始的。
然而在过去一年左右的时间里,JavaScript 的格局已经发生了很大的变化。例如,.NET JQuery 扩展最近被添加为官方 JQuery 插件。
在当前的模板引擎中,哪一个是最好使用的?以下是我知道的一些选项:
- JQuery-tmpl
- https://github.com/jquery/jquery-tmpl
- http://blog.jquery.com/2010/10/04/new-official-jquery-plugins-provide-templated-data-linking-and-globalization/
- http://weblogs.asp.net/scottgu/archive/2010/10/04/jquery-templates-data-link-and-globalization-accepted-as-official-jquery-plugins .aspx
- http://www.borismoore .com/2010/10/jquery-templates-is-now-official-jquery.html
- (以前是 NJE 项目)
- John Resig 的微模板
- JTemplates 中
- PURE(纯粹的不引人注目的渲染引擎)
- ASP.NET Ajax 模板
- jQuery Smarty
鉴于所有这些不同的选择,哪一个可能是最好的选择?
我试图在 Resig 的 Microtemplates 和 JQuery-tmpl 之间做出选择,但我不知道两者中哪一个更好,或者是否有比它们更好的选择。
任何熟悉许多可用选项的人都可以就此事提供一些建议吗?
So there are a bunch of older questions on this topic that point to a number of options available. These two questions for example are some of the most answered on the topic:
What good template language is supported in JavaScript?
Most of the answers to both questions are from 2008.
However in the past year or so the javascript landscape has evolved considerably. For example, the .NET JQuery extensions were recently added as official JQuery plugins.
Out of the current templating engines, which is the best one to use? Here are some options I'm aware of:
- JQuery-tmpl
- https://github.com/jquery/jquery-tmpl
- http://blog.jquery.com/2010/10/04/new-official-jquery-plugins-provide-templating-data-linking-and-globalization/
- http://weblogs.asp.net/scottgu/archive/2010/10/04/jquery-templates-data-link-and-globalization-accepted-as-official-jquery-plugins.aspx
- http://www.borismoore.com/2010/10/jquery-templates-is-now-official-jquery.html
- (formerly an NJE project)
- John Resig's Micro-templates
- http://ejohn.org/blog/javascript-micro-templating/
- included in underscore.js
- JTemplates
- PURE (Pure Unobtrusive Rendering Engine)
- ASP.NET Ajax Templates
- jQuery Smarty
Given all these different options, which is probably the best one to choose?
I was trying to decide between Resig's Microtemplates and JQuery-tmpl, but I don't know which of the two is better or if there is a better option than either of them.
Can anyone familiar with many of the options available lend some advice on this matter?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不应考虑 ASP.NET Ajax 库的 DataView。它在发布之前已被弃用,取而代之的是 jQuery 模板。
我已经使用 jTemplates 几年了,发现它足够可靠。然而,随着 jQuery 模板计划包含在 jQuery 1.5 核心中,采用外部依赖项来重新实现已包含在核心库中的内容是没有意义的。假设您正在使用 jQuery,仅此一点就足以支持 jQuery 模板。
The ASP.NET Ajax Library's DataView should not be considered. It was deprecated before release, in favor of jQuery Templates.
I've been using jTemplates for a couple years and have found it to be solid enough. However, with jQuery Templates slated for inclusion in jQuery 1.5 core, it doesn't make sense to take an external dependency that re-implements something already included in the core library. That alone is enough reason to favor jQuery Templates, assuming you're using jQuery.
这绝对是一个主观和争论性问题,我只是想添加性能到您可能考虑的事项列表中。
It's definetely a subjective and argumentative question, I've just wanted to add performance to the list of things you may consider.