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
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 概念了,比模板更高级点。
我也是刚接触AngularJS,觉得用起来还不是很熟练,与以前用的Jquery等都不一样,但是AngularJS在当下来说是非常流行的,它的确少去了像Jquery的DOM操作。其实每一个框架或模版都有优劣,也没有所谓的好用或不好用,只有熟不熟练!
10 BEST JAVASCRIPT TEMPLATE ENGINES FOR DEVELOPERS
自取所需!
如果你的业务不是极端注重效率,推荐nunjucks。
java,python,node三种语言的许多模板我都用过,还是觉得python中jinja2的设计最舒服,nunjucks是模仿的jinja2,虽然模拟的不彻底,但是也很不错了。
(swig和nunjucks差不多,而且语法的容错性比nunjucks稍好,虽然效率稍差一丁点,但是因为很久不更新了,不建议了就;
其实这两种模板相当于给jinja2做了个旁证,如果设计不好,也不会不约而同都去模仿~~)
arttemplate
推荐一个我觉得很牛逼的riotjs,你看看它1.x的版本里面有个简洁的模板实现,大概就10行左右的代码