Microsoft ASP.NET Web Optimization Framework 1.0.0 Debug Mode Error

I have two questions: one about error and one about cdn

QUESTION 1: (ERROR)

I just added a new NuGet package: Microsoft ASP.NET Web Optimization Framework 1.0.0. I am using ASP.NET MVC 3 and everything seems to work, except for one big mistake.

If I use debug = "true" in web.config, then no script tags are ever output. I checked the view source and there are no tags for this package.

If I set debug = "false" , then I get a script tag that points to my thumbnail file.

* Is this a mistake? Has anyone else experienced this? *

As a workaround so that I can debug my application, I forcefully optimized it regardless of whether I am in debug mode or not BundleTable.EnableOptimizations = true;

QUESTION 2: (CDN)

Another question I have about 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 have to add another package, so if UseCdn = "false", then it will try to load 2 scripts separately, which means 2 requests. Is there a way to have CDN support for multiple scenarios so that it combines them into a single request if UseCdn = "false"?

Something like that:

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

Regards DotnetShadow

+4
source share
1 answer

Could you extend what does not work in your MVC3 application, i.e. How do you use Scripts / Styles.Render methods?

As for No. 2, at present CDN support is provided only for each set. That way, you won’t be able to do the conditional binding you want and use cdn (if you didn’t have access to a CDN to which you could upload new content, then you could just load your package into a CDN)

+2
source

All Articles