1 true
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
1Bundles. ADD (NewStylebundle ("~/bundles/styles/benefits"). Include ("~/content/benefits/benefitsmaster.css", 2 "~/content/benefits/benefitshead.css" )); 3Bundles. ADD (NewScriptbundle ("~/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" )); 8Compress the style sheets, script pages, and create virtual paths, respectively
1 page calls directly: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.
But all are to use the command, but in MVC4.0 System.Web.Optimization already contain this east, they are jsminify and cssminify, do not underestimate these two classes, although the public method of two.
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