What is the best current Javascript templating engine? [closed]

佐手、 提交于 2019-12-04 10:13:55

问题


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?

jQuery templating engines

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
    • http://jtemplates.tpython.com/
    • http://plugins.jquery.com/project/jTemplates
  • PURE (Pure Unobtrusive Rendering Engine)
    • http://beebole.com/pure/
  • ASP.NET Ajax Templates
    • http://msdn.microsoft.com/en-us/magazine/cc546561.aspx
  • jQuery Smarty
    • https://github.com/balupton/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?


回答1:


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.




回答2:


It's definetely a subjective and argumentative question, I've just wanted to add performance to the list of things you may consider.



来源:https://stackoverflow.com/questions/4286181/what-is-the-best-current-javascript-templating-engine

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