Bundling - Process of merging many script files into one file for faster download as to save on many server rounds and connections is called bundling.
In App_Start/BundleConfig.cs add the following code
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"));
bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include(
"~/Scripts/jquery-ui-{version}.js"));
bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
"~/Scripts/jquery.unobtrusive*",
"~/Scripts/jquery.validate*"));
Minifying - Shorting the file by removing the empty spaces and is called minifying. As the size becomes small it takes much less time for download
Two ways to do it
1) Add following line of code in your web.config
In App_Start/BundleConfig.cs add the following code
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"));
bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include(
"~/Scripts/jquery-ui-{version}.js"));
bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
"~/Scripts/jquery.unobtrusive*",
"~/Scripts/jquery.validate*"));
Minifying - Shorting the file by removing the empty spaces and is called minifying. As the size becomes small it takes much less time for download
Two ways to do it
1) Add following line of code in your web.config
<compilation debug="false" />
2) In App_Start/BundleConfig.cs add the following code in RegisterBundles() method
BundleTable.EnableOptimizations = true
No comments:
Post a Comment