Sunday, December 30, 2018

Bundling in MVC MVC Bundling and minification is a technique to improve the request load time and introduced in MVC 4. bundlings has some following bundle classes in System.Web.Optimization namespace.

  1. ScriptBundle
  2. StyleBundle
  3. DynamicFolderBundle

the above bundles are included in MVC 5 and the namespace is System.Web.Optimization.Bundle.
it is a process of grouping the CSS/javascript files.
the most important of bundling is reduce the number of request from the browsers to the server, while minification reduces the size of requested assets.
Minification reduces the unnecessary white spaces and comments

Without Minification :

 allTechGeeks =function(city){
                                                   //this is comment
                                                   var test = "Hello World" + city ;
                                                   alert(test) ;
After Minification :
  allTechGeeks =function(city){var test = "Hello World" + city ;alert(test) ;}

in without minification, the javascript file has spaces and comments but after minification, we can't find the spaces and comments. So automatically the size of the file reduces but for development needs the without minification. in production minification file is good.

No comments: