Explain minification and how to implement the same?

Minification reduces the size of script and CSS files by removing blank spaces , comments etc. For example below is a simple javascript code with comments.

After implementing minification the javascript code looks something as below. You can see how whitespaces and comments are removed to minimize file size and thus increasing performance.

How do we implement bundling in MVC?

Open the “BundleConfig.cs” from the “App_Start” folder. In the “BundleConfig.cs” add the JS files which you want bundle in to single entity in to the bundles collection. In the below code we are combining all the javascript JS files which are existing in the “Scripts” folder as a single unit in to the bundle collection.

Below is how your “BundleConfig.cs” file will look like.

Once you have combined your scripts in to one single unit we then to include all the JS files in to the view using the below code. The below code needs to put in the ASPX or … Click here to continue…..

How does bundling increase performance?

Web projects always need CSS and script files.Bundling helps us to combine to multiple javascript and CSS file in to a single entity thus minimizing multiple requests in to a single request. For example consider the below web request to a page . This page consumes two JavaScript files “Javascript1.js” and “Javascript2.js”. So when this is page is requested it makes three request calls:- One for the “Index” page. Two requests for the other two JavaScript files “Javascript1.js” and “Javascript2.js”. Below scenario can become worst if we have lot of javascript files resulting in many multiple requests thus decreasing performance. If we can somehow … Click here to continue…..