Chapter 5. Minifying and bundling static files

 

This chapter covers

  • What is minification?
  • What is bundling?
  • Why should I minify or bundle my static files?
  • Minification and bundling in ASP.NET MVC and Web Forms

As a web developer, it’s important for you it’s important for you to look for imaginative ways to improve your page load times. This often involves reducing the number or weight of the HTTP requests that a user makes when loading a web page. In this chapter we examine bundling and minification, which will help you make fewer HTTP requests and severely reduce the weight of your web pages. ASP.NET 4.5 has fantastic new features that allow you to apply both techniques to your web application easily and automatically. By the end of this chapter, you’ll be able to apply these techniques to your web applications in no time!

5.1. What is minification?

Most developer-written JavaScript or CSS contains loads of extra spaces and line breaks that don’t get run when the code is executed. Removing these unnecessary spaces and line breaks, a technique known as minification, reduces the overall size of the file and, in turn, results in faster page load time, without affecting the integrity of its contents. The code downloads and executes faster, but the code will run in the very same manner—it’s an easy win!

5.2. What is bundling?

5.3. New bundling and minifying features in ASP.NET 4.5

5.4. Utilizing bundling in ASP.NET MVC

5.5. Utilizing bundling in ASP.NET Web Forms

5.6. The results

5.7. Summary