Is there any native compression (for javascript/css files) available in ASP.NET?
Bundling and minification are two techniques you can use in ASP.NET to improve page load performance for your web application. Bundling combines multiple files into a single file. Minification performs a variety of different code optimizations to scripts and CSS, which results in smaller payloads.
To enable bundling and minification, set the debug value to "false". You can override the Web. config setting with the EnableOptimizations property on the BundleTable class. The following code enables bundling and minification and overrides any setting in the Web.
By default, the MVC application's BundleConfig (located inside App_Start folder) comes with the following code − public static void RegisterBundles(BundleCollection bundles) { // Following is the sample code to bundle all the css files in the project // The code to bundle other javascript files will also be similar to ...
Simply right-click the bundleconfig. json file to enable it. Clicking the menu item will prompt you with information about what will happen if you click the OK button. A NuGet package will be installed into the packages folder without adding any files to the project itself.
Try Chirpy. It mashes, minifies, and validates your javascript, stylesheet, and dotless files. You can use YUI Compressor or Google Closure Compiler.
http://chirpy.codeplex.com/
Or, for more info, check out:
http://www.weirdlover.com/2010/05/22/visual-studio-add-in-for-dotless-js-and-css-files/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With