📜 ⬆️ ⬇️

Yate: Yandex.Mail has moved to a new template engine

image Some time ago we wrote that a new interface had appeared in Yandex.Mail that uses template data in the browser. Few major services dared to do this, but we still consider this solution as the most successful. It not only accelerated the operation of the interface, but also allows you to save user traffic and more efficiently spend the processor time of the servers.

Then we used XSL as a template engine, and the data was transmitted in XML format. Having transferred the project to a new interface, we started looking for other ways to speed up the work of the Yandex.Mail interface.

Recently we transferred all Mail to JS template engine and JSON data.

Reasons for not using XML / XSL
We are very fond of XSL, it is expressive, it is really convenient to write templates for large services with complex connections, a large number of reusable blocks and the ability to redefine or extend blocks. But he has a number of significant drawbacks:
')



( , ) , : yate, handlebars, jade, dust ajaxslt.

json- , .

(, , , , , ), /. .

, (handlebars, jade, dust) , «», . XSL , .

, yate ajaxslt. , , ajaxslt yate 500 .

200 :

image

Yate
Yate — , - . , . Yate XSL: js- (match, apply), , jpath — XPath JSON. javascript , .

XSL yate:

image

, , yate — , JavaScript XSL-. , , JS , .

yate, 40% , . … 1200%!

, .
– JS-, , :

image

, , .

, , , , , :

image

, – 200. 30 , :

image

— - , debugger , . log, , .

, . yate . , , , , HTML.

image

yate , , . , JavaScript :

image


. .
, , JSON, E4X XML2JSON. , , XSL/XML, . . , «» :

image

:

image

, , .

DIY
, yate . yate , npm install yate.

jpath. XPath JSON (jpath no.path) vim Sublime Text. XSL-, , yate xsl2yate.

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


All Articles