Skip to main content


Showing posts from August, 2013

.NET 4.0 Bundle of Joy

It use to be that you would have to summon the mighty powers of YUI compressor and roll out the red carpets of MSBuild to minify CSS and JS files in your ASP.NET and MVC applications.  With the introduction of bundling in System.Web.Optimization (now Microsoft.AspNet.Web.Optimization) you can skip the formalities and bundle your JS and CSS file without introducing additional dependencies. To use bundling in a .NET 4.0 app. 1- Create an App_Start folder in your solution (if you don't have one already) 2- Add a class in your App_Start folder for your bundles and create a function to call all your CSS and JS files. E.g. (BundleConfig.cs) Code Snippet using System.Web; using System.Web.Optimization;   namespace YourGlobalNameSpace {      public class BundleConfig     {          public static void RegisterBundles(BundleCollection bundles)         {             bundles.Add( new StyleBundle( "~/styles/style" ).Include                 ( "~/s