Chapter 21Task Runners
In the examples we’ve shown in many of the Angular chapters, all the JavaScript code lies in a single file. There are several benefits of working with a single file. The browser only needs to download one file containing all of our JavaScript, and can reuse a cached version everywhere on the site. It also reduces download order issues because everything is contained in a single file with the code in the proper, logical order. The entire block of code can be wrapped in a function expression that keeps the contents out of the global namespace. Finally, minification can reduce the browser download size, sometimes as much as 80%. The downside of working with a single file is the maintenance, especially when working within a ...
Get Full Stack JavaScript Development With MEAN now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.