LinkedIn把他们转template engine的经验给blog了下来, post里边的数据可能已经outdated了,不过还是很有參考价值的,楼主可以参考一下: The client-side templating throwdown: mustache, handlebars, dust.js, and more
他们的测评准则:
DRY: how DRY is the templating technology? is there support for code-reuse and partials?
i18n: is there support for translations and multiple languages?
Hot reload: are changes visible immediately or is there a compile/deploy cycle?
Performance: how long does it take to render in the browser and server?
Ramp-up time: how is the learning curve?
Ramped-up productivity: once you've ramped-up, how fast can you build things?
Server/client support: can the same template be rendered both client-side and server-side?
Community: is there an active community using this project? Can you google issues?
Library agnostic: are there dependencies on other JS libraries, such as jQuery or Mootools?
Testable: how hard is it to write unit and integration tests?
Debuggable: is it possible to step through the code while it's running to track down errors?
Editor support: is there an editor with auto-complete, syntax highlighting, error checking, etc?
Maturity: is this a relatively stable project or still experimenting and churning?
Documentation: how is the documentation?
Code documentation: do the templates encourage/require documentation/comments?
个人比较常用handlebars,因为不想view里面有太多logical的东西, 而且HBS可以precompile,还可以自由选择在server或是client side render 最后就是handlebars跟jq一点关系都没有..
试一下artTemplate
个人觉得萝卜青菜各有所爱,根据需求和喜好加以选择,多多尝试。
如果写过JSP或PHP的话,喜欢
<% %>
,必然推荐TJ大神的EJS给你,地址:https://github.com/tj/ejs如果写过Python,喜欢简洁,优美的格式,推荐TJ大神的另一款力作Jade,地址:https://github.com/jadejs/jade
LinkedIn把他们转template engine的经验给blog了下来,
post里边的数据可能已经outdated了,不过还是很有參考价值的,楼主可以参考一下:
The client-side templating throwdown: mustache, handlebars, dust.js, and more
他们的测评准则:
DRY: how DRY is the templating technology? is there support for code-reuse and partials?
i18n: is there support for translations and multiple languages?
Hot reload: are changes visible immediately or is there a compile/deploy cycle?
Performance: how long does it take to render in the browser and server?
Ramp-up time: how is the learning curve?
Ramped-up productivity: once you've ramped-up, how fast can you build things?
Server/client support: can the same template be rendered both client-side and server-side?
Community: is there an active community using this project? Can you google issues?
Library agnostic: are there dependencies on other JS libraries, such as jQuery or Mootools?
Testable: how hard is it to write unit and integration tests?
Debuggable: is it possible to step through the code while it's running to track down errors?
Editor support: is there an editor with auto-complete, syntax highlighting, error checking, etc?
Maturity: is this a relatively stable project or still experimenting and churning?
Documentation: how is the documentation?
Code documentation: do the templates encourage/require documentation/comments?
个人比较常用handlebars,因为不想view里面有太多logical的东西,
而且HBS可以precompile,还可以自由选择在server或是client side render
最后就是handlebars跟jq一点关系都没有..
dot.js 速度快,这是有评测数据的,同时支持在模版中加入js语法。
vue.js 国人做的框架 和angular类似 不过精简了很多。中文文档非常全。
如果纯用模板的话,推荐doT,速度快,支持编译成函数。如果想高级的推荐 riotjs 2.0 、react, 这两个是 webcomponent 概念了,比模板更高级点。
貌似Juicer很不错的。 http://juicer.name/
Source Code: https://github.com/vczh-libraries/GacJS/blob/master/Script/Html/Razor.js
Test Case: https://github.com/vczh-libraries/GacJS/blob/master/Razor.html
不如来试试我模仿ASP.NET MVC写的JS实现的Razor引擎?我的Razor引擎加载之后编译成了一个Javascript函数,支持参数,可以在任何地方调用生成HTML,嵌入到任何你想使用的地方。
我也是刚接触AngularJS,觉得用起来还不是很熟练,与以前用的Jquery等都不一样,但是AngularJS在当下来说是非常流行的,它的确少去了像Jquery的DOM操作。其实每一个框架或模版都有优劣,也没有所谓的好用或不好用,只有熟不熟练!
10 BEST JAVASCRIPT TEMPLATE ENGINES FOR DEVELOPERS
自取所需!