c# - Add Multiple Scripts / Styles in a Single Bundle Using a CDN -


i trying utilise azure cdn make bundles load possible.

i trying add multiple different files in each bundle , in network tab can see loading 'cdnaddress' not distinct files inside it, each bundle load file included in 'cdnaddress'.

bundles.add(new stylebundle("~/resources/css/plugins/effects", cdnaddress).include("~/content/styles/animate/animate.min.css").include("~/content/styles/hover/hover-min.css")); 

the example above shows trying put 2 different css files same bundle can make 1 request on pages use both bundles. cdn path can submitted once.

i want set 'cdnaddress' root url of cdn, possible? if not, how can achieve goal without making 2 different bundles.

as have lot of bundles looking easy maintain solution can tell cdn , let figure out cdn paths files, mirror of website. working on cms, possible cdn not configured, , therefore cdn path null.

enter image description here

i want set 'cdnaddress' root url of cdn, possible? if not, how can achieve goal without making 2 different bundles.

afaik, not serve multiple cdn paths in single bundle. , scriptbundle.include contain several local virtual paths.

you follow approaches below achieve purpose:

  • define bundle each cdn path;

  • you combine related files manually , upload them cdn path , use cdn path several local virtual paths.

sample:

bundles.add(new scriptbundle("~/bundles/bootstrap").include(             "~/scripts/bootstrap.js",             "~/scripts/respond.js")); //to  bundles.usecdn = true; bundles.add(new scriptbundle("~/bundles/bootstrap", "http://yourcdnsite/scripts/bootstrap.js").include(             "~/scripts/bootstrap.js"));  bundles.add(new scriptbundle("~/bundles/bootstrap", "http://yourcdnsite/scripts/respond.js").include(             "~/scripts/respond.js")); bundletable.enableoptimizations = true;  //or  bundles.usecdn = true; bundles.add(new scriptbundle("~/bundles/bootstrap", "http://yourcdnsite/scripts/<the-combination-of-bootstrap.js-and-respond.js>.js").include(             "~/scripts/bootstrap.js",             "~/scripts/respond.js")); bundletable.enableoptimizations = true; 

Comments

Popular posts from this blog

javascript - Create a stacked percentage column -

Optimising Firebase database by automatically overwriting data -

javascript - Angular UI-Grid customTemplate directive causing rows to load slowly/? -