Good Javascript template engine to work with JSON

前端 未结 8 1136
青春惊慌失措
青春惊慌失措 2020-12-06 08:54

I have looked at jTemplates and it\'s worth a try. Are there any other template engines other than jTemplates?

相关标签:
8条回答
  • 2020-12-06 09:10

    Yajet is a new one, spotting a syntax different from anything we've seen before. :-) It compiles the templates and it's blazing fast. It's browser and library-agnostic; there is a small jQuery wrapper for people who can't live without jQuery, but the engine itself is independent and can run in Rhino or V8 too.

    It supports many directives that allow conditionals, loops, define reusable template components etc.

    0 讨论(0)
  • 2020-12-06 09:11

    Did you try pure.js ?

    The main difference with the dozens of JS templating engines available is that PURE leaves the HTML totally separated from the JS logic. And it's pretty fast too.

    However it is not the common <% ... %> kind of templating programming you may like.
    It has a pattern/declarative approach which has some similarity with XSLT (but without the pain...)

    0 讨论(0)
  • 2020-12-06 09:11

    Here is one implemented in jQuery for the Smarty templating language. http://www.balupton.com/sandbox/jquery-smarty/demo/

    One impressive feature is the support for dynamic updates. So if you update a template variable, it will update anywhere in the template where that variable is used. Pretty nifty.

    You can also hook into variable changes using a onchange event. So that is useful for say performing effects or AJAX when say the variable "page" changes ;-)

    0 讨论(0)
  • 2020-12-06 09:11

    Its worth looking at the following link.

    https://github.com/nje/jquery/wiki/jquery-templates-proposal

    0 讨论(0)
  • 2020-12-06 09:17

    Try async-js-templates. Its fast because it does paralell requests that can be async.

    It is shiped with maven.

    0 讨论(0)
  • 2020-12-06 09:19

    After having this question in 2017, it looks like JsRender and JsViews have emerged as the current official implementation of templating within the jQuery ecosystem (whilst not necessarily requiring jQuery):

    JsRender is a light-weight but powerful templating engine, highly extensible, and optimized for high-performance rendering, without DOM dependency. It is designed for use in the browser or on Node.js, with or without jQuery.

    JsRender and JsViews together provide the next-generation implementation of the official jQuery plugins JQuery Templates, and JQuery Data Link -- and supersede those libraries.

    - JsRender GitHub Readme

    Official Site: http://www.jsviews.com/

    GitHub (JsRender): https://github.com/BorisMoore/jsrender

    GitHub (JsViews): https://github.com/BorisMoore/jsviews

    0 讨论(0)
提交回复
热议问题