K
K
Konstantin Kitmanov2013-06-20 11:21:21
JavaScript
Konstantin Kitmanov, 2013-06-20 11:21:21

Pre-compilation of templates in the client-side application - is it necessary?

We are talking about compiling templates on the server, at the deployment stage, or immediately before giving the statics to the browser.

Why I had doubts is that compiled templates are clearly larger than uncompiled ones (for devices with poor internet, this is critical), and any decent template engine caches once compiled anyway (and even if not, this is trivial to do at the application level).

Answer the question

In order to leave comments, you need to log in

4 answer(s)
N
nur, 2013-06-20
@nur

Do not forget about gzip, it will shake everything for you very cheerfully. And compiling on the client is not very good.

B
blare, 2013-06-20
@blare

Need of course, but how without it? If this client does not compile templates for all users of the site, then it will make a dozen templates at a time without problems. Template engines are very fast, even SmartyJS. After all, that's the point of templates. Moreover, after one compilation, if the template is used constantly, it will no longer have to be compiled. Just do not compile everything at once, but only when necessary.

E
egorinsk, 2013-06-20
@egorinsk

You can not only compile, but, for example, cut out spaces, and they often make up half of the template.

B
blare, 2013-06-20
@blare

Then the question is somewhat unclear. What about compilation on the server and Javascript, or are you using server-side JS?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question