Minified script only in MVC4 BundleConfig
asp.net-mvc, asp.net-mvc-4, asp.net-optimization, bundle, razor
Solution
This behavior has been improved (fixed) in the 1.1.0-alpha1 release. We moved all of the old default ignore list entries into a new DirectoryFilter ignore list that are only used when including search patterns like *.js which was the origional intent for this functionality. As a result this should no longer be an issue when you are including individual files explicitly.
Note: the one place this might still be an issue is if you try to include something like jquery-{version}.min.js.
Problem
I am adding the following ScriptBundle in BundleConfig: ``` bundles.Add(new ScriptBundle("~/bundles/javascript").Include( "~/Scripts/jquery-1.*", "~/Scripts/load-image.min.js", "~/Scripts/bootstrap.*", "~/Scripts/bootstrap-image-gallery.*", "~/Scripts/my.global.js")); ``` This is referenced at the end of my _Layout.cshtml as: ``` @Scripts.Render("~/bundles/javascript") ``` When debugging I notice that the output of this script rendering is: ``` <script src="/Scripts/jquery-1.8.2.js"></script> <script src="/Scripts/bootstrap.js"></script> <script src="/Scripts/bootstrap-image-gallery.js"></script> <script src="/Scripts/my.global.js"></script> ``` Notice the load-image.min.js script is missing? What I want is to use that same minified script whether I'm debugging or not. Under release conditions the script is included in the bundled JS file. I assume it's seeing the 'min', looking for an un-minified version, not finding one, then deciding what's best is to ignore it entirely. Brilliant. If I make a copy of load-image.min.js, call it load-image.js and then reference it in BundleConfig as "load-image.*" I find it is included in both configurations but what's the point of having to do that? I assume I'm missing something here. I don't have the un-minified version and I frankly don't care about it. It's used by my Bootstrap image gallery plugin and nothing else. Any ideas out there?