The bundleconfig operation in the MVC project is that Microsoft has prepared CSS and JS compression for us, we can put the template page style sheet and script into this place compression (too many sub-pages, so another compression). This configuration file under the App_start folder, Global.asax in the global profile, will enable this profile, after the enableoptimizations settings, you can allow compression and do not allow operation
1 bundles. ADD (New Stylebundle ("~/bundles/styles/benefits"). Include ("~/content/benefits/benefitsmaster.css", 2 "~/content/benefits/benefitshead.css")); 3 bundles. ADD (New Scriptbundle ("~/bundles/scripts/base"). Include ("~/scripts/sea.js", 4 "~/scripts/seajs/style.js", 5 "~/scripts/seajs/combo.js", 6 "~/scripts/seajs /config.js ", 7" ~/scripts/fmall/init.js ")); 8 Compress the style sheet, script page, and create the virtual path, respectively
1 Page Direct call: 2 @Styles. Render ("~/content/themes/base/css", "~/content/css") 3 @Scripts. Render ("~/bundles/modernizr") The item is also contained in three, I am independent, the main feeling is that I think he is a good guy.
Code is simple, but very applicable, do not know if you have used ajaxminify this east, can be compiled, compressed into the smallest content.
By using scripts and styles to introduce scripts and style sheets into a page, the script and stylesheet can be compiled and compressed into the client without modifying any code, as described above.
This can not only effectively increase the difficulty of jshack and reduce the size of the file. To achieve this, we only need to set a property in Bundletable to True!!
System.Web.Optimization compression operations on scripts and style sheets