MVC CDN fallback for Style Bundle

TLDR;

Check out my solution which provides a StyleBundle extension method to solve the problem.

Style Bundle Fallback

Also

Yes there is a bug in the Microsoft ASP.NET Optimization Framework, documented here.

The solution is to modify the CdnFallbackExpression to be a javascript function that both checks for the stylesheet and loads the fallback, thus ignoring the bad script from the Optimization Framework.

There are a couple of tricky parts, especially checking for a stylesheet being loaded when it comes from another domain, like most CDN sources.

I have a solution on GitHub that you can use until the issue is fixed in the framework; however, I'd still watch out for the tricky part of determining when the stylesheet is actually loaded.