0

How does one combined multiple Javascript CDN files into one massive bundle in Visual Studio .NET 4.5 ?

I've seen the following online, but this only shows 1 CDN, which also provides no benefit since bundling 1 item is useless...

bundles.UseCdn = true;   //enable CDN support

//add link to jquery on the CDN
var jqueryCdnPath = "http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.1.min.js";

bundles.Add(new ScriptBundle("~/bundles/jquery", jqueryCdnPath).Include(
            "~/Scripts/jquery-{version}.js"));

How about if I have multiple CDN files that I would like to smash together into 1 http request, is it possible to in turn combined them all?

Mark Pieszak - Trilon.io
  • 61,391
  • 14
  • 82
  • 96
  • Those cdns that provide that probably has something you need to add in url. I don't think it's possible to *smash* two cdn requests into one request. They probably send something like `http://cdn.com/jquery@1.8.3+ko.js@1.1.1`. – Stan Dec 19 '13 at 21:28
  • Bundling one item (such as jquery) is not useless. You get the cached version from a previously visited site for your own site. By creating "CDN bundles" you create a situation where there are many library combinations. How would the browser choose the correct cached library from a bundle like that? Which url key will it use? It's simply a custom bundle for your site -- in which case you could've just downloaded these packages yourself and made a regular bundle. – Jasen Dec 19 '13 at 22:00

0 Answers0