4 ms·
If you can inline static JSON you're a small amount of effort away from using server-templating to serve HTML. Do that.
by jaffathecake 13y ago
If you can inline static JSON you're a small amount of effort away from using server-templating to serve HTML. Do that.
- tuxracer 13y agoHardly. Your backend needs to support both your templating language and whatever you're using to populate those templates. Which means either adding support for JavaScript to your backend or creating and maintaining redundant code. Meanwhile your backend could be Python, Ruby, whatever and can easily inline the initial chunk of JSON without needing support for any of the frontend technologies doing the actual template rendering (such as Handlebars+Backbone for example). So far as still needing to wait for JavaScript to download it becomes a matter of how the ROI works out for one's particular use case. Let's say simply inlining the JSON for the initial content narrows that 'time to initial content' gap to a few hundred milliseconds. Is removing that gap still a worthy return on your investment?