O'Reilly logo

Mastering JavaScript Single Page Application Development by John Moore, Philip Klauzinski

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Optimizing your application layout

Building a JavaScript SPA can often involve many layers of abstraction including custom application code, third party libraries, frontend frameworks, task runners, transpilers, and more. All of this can end up amounting to a whole lot of JavaScript to be downloaded for the application on the frontend, so steps should always be taken to minimize this impact as much as possible.

Let's go back to the Node.js example application we have been working with so far. In Chapter 2Model-View-Whatever we wrote the index.html layout page for the app with the following script tags included for third party libraries and the compiled templates:

<script src="/bower_components/jquery/dist/jquery.min.js"></script> <script src="/bower_components/handlebars/handlebars.runtime.min.js"></script> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required