4 ms·
There is this interesting pattern of having template compilation be possible from both the server and the client, such as with AirBnB's Rendr. It gives you the
by paulbjensen 13y ago
There is this interesting pattern of having template compilation be possible from both the server and the client, such as with AirBnB's Rendr. It gives you the flexibility to choose where you want that template compilation to occur.
With regards to Twitter's Time To First Tweet being slow under their Single Page App, I recall Alex Maccaw mentioning that their JavaScript library execution was inefficient, in that the client had to download a whole bunch of JavaScript before it would load the part of the app responsible for rendering the data.
I believe he was suggesting that if Twitter optimised the delivery so that parts of Twitter's JS were served after the rendering part of Twitter's JS code, then the time to first tweet could be faster.
In my opinion, delegating template compilation to the client offers a nice separation of concerns; the server is the API, and the client is the UI.
It would be interesting if there was benchmarking done into comparing these approaches, to see where server-side template compilation can be beneficial over client-side template compilation.
- agilebyte 13y agoExactly, RequireJS if you need to load parts of the client dynamically but use plain old HTML for initial page delivery if you have a lot of results. It is also what is recommended for Backbone, for example: http://backbonejs.org/#FAQ-bootstrap http://backbonejs.org/#FAQ-bootstrap