3 ms·
Has anyone here tried optimizing initial page load by including the json data passed to various templates as part of the page, rather than making a separate req
by enoughalready 15y ago
Has anyone here tried optimizing initial page load by including the json data passed to various templates as part of the page, rather than making a separate request to get the data?
for example, what i've been doing is using a server side template write out the clientside templates and initial json data used by the clientside templates:
<script type="text/javascript">
var viewModel = {{- JSON.stringify(viewModel); }};
</script>
- jashkenas 15y agoYes -- it's highly recommended to bootstrap all of the data you need for an initial load, and avoid any extra HTTP requests. From the FAQ: http://backbonejs.org/#FAQ-bootstrap http://backbonejs.org/#FAQ-bootstrap