|
The principle of bundling and compression is to dynamically merge and compress multiple CSS files into one CSS file, and multiple JS files to be dynamically merged and compressed into one JS file, so as to reduce the number of browser requests to server resource files, reduce the size of resource files and improve the response speed of the page. ASP.NET 4.5 and above support this technology (Optimization).
How to use:
First nuget download the package Microsoft.AspNet.Web.Optimization, and then configure it as follows:
Step 1: As usual, create a new class under the App_start folder, as shown in the figure:
Here is a parameter "BundleTable.EnableOptimizations":
If this is not set, System.Web.Optimization uses the default policy,
atDebug modeNot enabledMerge and compression.
atRelease modeEnableMerge and compression.
If set, the default policy will be overridden;
|