Question

I have two questions, one about a bug and one about cdn

QUESTION 1: (BUG)

I have just added the new NuGet package: Microsoft ASP.NET Web Optimization Framework 1.0.0. I'm using ASP.NET MVC 3, and everything seems to be working except for one major bug.

If I use debug="true" in web.config, then no script tags ever get outputted. I checked the view source and there are no tags for that bundle at all.

If I set debug="false" then I get the script tag that points to my minification file.

*Is this a bug? Has anyone else experienced that? *

As a workaround so that I'm at least able to debug my application, I forced optimization on regardless if I'm in debug mode or not BundleTable.EnableOptimizations = true;

QUESTION 2: (CDN)

Also another question I have is about the CDN Support:

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

If I want to add another script with CDN support, then I would have to add another bundle, therefore if UseCdn="false", then it will try and load up 2 scripts separately, meaning 2 requests. Is there any way to have CDN support for multiple scripts so that it will combine them into 1 request if UseCdn="false"?

Something like this:

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

Regards DotnetShadow

Was it helpful?

Solution

Could you expand on what isn't working on in your MVC3 app, i.e. how are you using the Scripts/Styles.Render methods?

In regards to #2, currently the CDN support is only on a per bundle basis. So you will not be able to do the conditional bundling that you want and use cdn (unless you had access to a CDN which you could upload new content to, then you could just upload your bundle to the CDN)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top