0

Found this snippet to add cdn file into bundle:

public static void RegisterBundles(BundleCollection bundles)
{
    //bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
    //            "~/Scripts/jquery-{version}.js"));

    bundles.UseCdn = true;   //enable CDN support

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

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

But is there any way to add multiple cdn files into that bundle? We have locally hosted cdn if that makes a difference, so the url for jqueryCdnPath would start with https://localhost... most likely (comes from config).

Include() supports array of string (but my understanding is these are local files only used when Debuggin), but for cdn part (used in release mode) I cannot see this to be the case??

Found this question here, there is no answer and it is from 2013 so thought maybe something has changed since then..

Many Thanks

JanT
  • 2,105
  • 3
  • 28
  • 35
  • Does this answer your question? [Add many CDN bundles in MVC](https://stackoverflow.com/questions/48129653/add-many-cdn-bundles-in-mvc) – Muhammad Asad Nov 18 '21 at 12:09
  • @Muhammad Asad - No, unfortunately it does not. I want to add multiple files that are external to the solution (coming from locally hosted cdn) into the bundle. – JanT Nov 18 '21 at 13:19

0 Answers0