Miniature script only in MVC4 BundleConfig

I add the following ScriptBundle to the 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 the link at the end of my _Layout.cshtml as:

 @Scripts.Render("~/bundles/javascript") 

When debugging, I notice that the output of this rendering script 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> 

Note that load-image.min.js script is missing? I want to use the same minified script whether I am debugging or not. In terms of release, the script is contained in the complete JS file.

I assume that he sees the "mines", looking for an undefined version, I can not find it, and then deciding that it is best to ignore it completely. Brilliant. If I create a copy of load-image.min.js, name it load-image.js and then refer to it in the BundleConfig as "load-image. *". I believe that it is included in both configurations, but what's the point of doing it?

I guess something is missing here. I do not have a version without restrictions, and I frankly do not care about it. It is used by my Bootstrap image gallery plugin and nothing else. Any ideas there?

+8
asp.net-mvc razor asp.net-mvc-4 bundle asp.net-optimization
source share
2 answers

This behavior has been improved (fixed) in version 1.1.0-alpha1. We have moved all the old default ignore list entries to the new DirectoryFilter ignore list, which is only used when including search patterns such as * .js, which was the original intention for this function. As a result, this will no longer be a problem if you include individual files explicitly.

Note. In one place, this can be a problem if you try to include something like jquery- {version} .min.js.

+4
source share

There is an ignoreList that you can clear if you need, it looks like this:

 public static void AddDefaultIgnorePatterns(IgnoreList ignoreList) { if (ignoreList != null) { 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); return; } else { throw new ArgumentNullException("ignoreList"); } } 

More: Additional options for adding and minimizing ASP.NET

+5
source share

All Articles