Javascript / jquery templating suggestions

I am developing a large-scale application heavily dependent on javascript. Part of this will contain information on the screen. I am looking to display ui information, and I am considering using a javascript template for this. I will use the jquery framework.

Any suggestions or recommendations for javascript / jquery templating frameworks?

+4
source share
4 answers

It is not based on jQuery, but according to performance tests on jsperf.com, doT.js is invariably the fastest structure of JS templates. It has no dependencies, so you can use it with jQuery.

+1
source

Here is a useful library for jquery templates: http://icanhazjs.com/ Also, it got an interesting name!

+1
source

Agree only with GregL. The original test does not take into account the time taken to ultimately add the displayed html to the page.

You can also check out http://jsperf.com/dom-vs-innerhtml-based-templating/259
This test will include adding the displayed html text to the page.

You can compare it with http://jsperf.com/dom-vs-innerhtml-based-templating/257
Original test case. You will learn that the difference between template engines is not that important. You need to learn more about the usability of the template engine if you are not going to just display a patch of html text without putting it in a client browser.

In addition, in my opinion, a good template engine should help you maintain templates, help you write less, do more, which is also a jQuery principle.

doT.js is really good at performance, but I do not agree that it can help you code effectively.

Now I'm working on an open source project to try to create an easy-to-use template engine. It can help you manage your templates in a tree structure, create a link to a template, define your own syntax, bind data with html dom .. please try

http://jspopisno1.github.com/Beard

You can also read another question on stackoverflow

https://stackoverflow.com/questions/552934/what-javascript-templating-engine-do-you-recommend/8129492#8129492

+1
source

Yes, I used this John Resigs Microtemplating engine with great success on several projects. It is very simple, easy to maintain and easy to use.

0
source

Source: https://habr.com/ru/post/1381223/


All Articles