찾다

 >  Q&A  >  본문

javascript - 有什么好用的JS模板引擎吗?

有什么好用的JS模板引擎吗?
比如说 handlebars
或者 augularjs 这些的模板引擎,个人感觉都不是特别好用啊

有没有什么比较好用的模板引擎?

天蓬老师天蓬老师2813일 전3084

모든 응답(27)나는 대답할 것이다

  • 伊谢尔伦

    伊谢尔伦2017-04-10 16:29:49

    试一下artTemplate

    회신하다
    0
  • 迷茫

    迷茫2017-04-10 16:29:49

    个人觉得萝卜青菜各有所爱,根据需求和喜好加以选择,多多尝试。
    如果写过JSP或PHP的话,喜欢<% %>,必然推荐TJ大神的EJS给你,地址:https://github.com/tj/ejs
    如果写过Python,喜欢简洁,优美的格式,推荐TJ大神的另一款力作Jade,地址:https://github.com/jadejs/jade

    회신하다
    0
  • PHP中文网

    PHP中文网2017-04-10 16:29:49

    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一点关系都没有..

    회신하다
    0
  • ringa_lee

    ringa_lee2017-04-10 16:29:49

    dot.js 速度快,这是有评测数据的,同时支持在模版中加入js语法。

    회신하다
    0
  • 阿神

    阿神2017-04-10 16:29:49

    vue.js 国人做的框架 和angular类似 不过精简了很多。中文文档非常全。

    회신하다
    0
  • 高洛峰

    高洛峰2017-04-10 16:29:49

    如果纯用模板的话,推荐doT,速度快,支持编译成函数。如果想高级的推荐 riotjs 2.0 、react, 这两个是 webcomponent 概念了,比模板更高级点。

    회신하다
    0
  • 迷茫

    迷茫2017-04-10 16:29:49

    貌似Juicer很不错的。 http://juicer.name/

    회신하다
    0
  • PHPz

    PHPz2017-04-10 16:29:49

    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,嵌入到任何你想使用的地方。

    회신하다
    0
  • 伊谢尔伦

    伊谢尔伦2017-04-10 16:29:49

    我也是刚接触AngularJS,觉得用起来还不是很熟练,与以前用的Jquery等都不一样,但是AngularJS在当下来说是非常流行的,它的确少去了像Jquery的DOM操作。其实每一个框架或模版都有优劣,也没有所谓的好用或不好用,只有熟不熟练!

    회신하다
    0
  • ringa_lee

    ringa_lee2017-04-10 16:29:49

    10 BEST JAVASCRIPT TEMPLATE ENGINES FOR DEVELOPERS

    自取所需!

    회신하다
    0
  • 취소회신하다