Sunday, January 26, 2014

Bundling and Minification


Basically a developer uses multiple JS and CSS files for modularity, readability and maintainability of code and it’s a good practice too. But in some cases it leads to degradation of the overall performance of the website. Because multiple JS and CSS files require multiple HTTP requests from a browser leads to degrade the performance & load time of your web pages.

In real-time, almost every website uses
Minification technique to improving their load times, but bundling is not used commonly because every page required different sets of files and the application will also not support as much to make it simpler.

Bundling: It’s a simple logical group of files that could be referenced by unique name and being loaded with one HTTP requestor.

Minification: It’s a process of removing unnecessary whitespace, line break and comments from code to reduce its size thereby improving load times.

 

Bundling
Bundling is a new feature in ASP.NET 4.5 that makes it easy to combine or bundle multiple files into a single file. You can create CSS, JavaScript and other bundles. Fewer files means fewer HTTP requests and that can improve first page load  performance.

 

Minification

Minification performs a variety of different code optimizations to scripts or css, such as removing unnecessary white space and comments and shortening variable names to one character. Consider the following JavaScript function.

 

  BundleTable.EnableOptimizations = true;

 

No comments:

Post a Comment