Recently, my local copy of a project completely lost most of its styling. Took me a while to figure it out, as most of the styling was done in one file and the rest were min
By default, files with names ending in ".min.css" will only be included in release builds.
The recommended bundle configuration is to only include non-minified .css and .js files, then the .min version will be automatically selected (if it exists) in release builds, i.e. <compilation debug="false">
in your Web.config.
You can control this behavior by clearing and then adding ignore rules to the BundleCollection.IgnoreList. An example BundleConfig
could look like this:
public static class BundleConfig
{
public static void RegisterBundles(BundleCollection bundles)
{
ConfigureIgnoreList(bundles.IgnoreList);
// Setup your bundles...
}
public static void ConfigureIgnoreList(IgnoreList ignoreList)
{
if (ignoreList == null) throw new ArgumentNullException("ignoreList");
ignoreList.Clear(); // Clear the list, then add the new patterns.
ignoreList.Ignore("*.intellisense.js");
ignoreList.Ignore("*-vsdoc.js");
ignoreList.Ignore("*.debug.js", OptimizationMode.WhenEnabled);
// ignoreList.Ignore("*.min.js", OptimizationMode.WhenDisabled);
ignoreList.Ignore("*.min.css", OptimizationMode.WhenDisabled);
}
}
You can also explicitly enable/disable the optimization by setting BundleTable.EnableOptimizations.