0

I am a new ASP.NET developer and I am trying to use one of the greatest features of ASP.NET 4.5 which is Bundling feature. It appears to have some support for use of CDNs. I am struggling right now in using Bundling for getting the bootstrap 3.2.0. So how can I do that?

Here's a snippet of my code:

public static void RegisterBundles(BundleCollection bundles)
        {
            bundles.UseCdn = true;   //enable CDN support

            //add link to jquery on the CDN
            var cssCdnPath = "http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css";

            bundles.Add(new StyleBundle("~/bundles/css",
                      cssCdnPath).Include(
                      "~/Assets/css/bootstrap-{version}.css"));
}
user3107976
  • 185
  • 1
  • 2
  • 13

1 Answers1

1

The CDN location is only used when the BundleTable.EnableOptimizations is configured to be true.

Simple add the following to the RegisterBundles method:

BundleTable.EnableOptimizations = true;