Introduction to JS/CSS packaging and compression functions of MVC 4 in ASP. NET, asp. netmvc
The MVC4 package compression function @ Scripts. Render ("~ /Bundles/jquery ").
bundles.Add(new ScriptBundle("~/bundles/jquery").Include( "~/Scripts/jquery-{version}.js", "~/Scripts/jquery.unobtrusive-ajax.js" ));
This can be written,
bundles.Add(new ScriptBundle("~/bundles/jquery").Include( "~/Scripts/jquery-{version}.js", "~/Scripts/jquery.unobtrusive-ajax.min.js" ));
This write method is not feasible.
"~/Scripts/jquery.unobtrusive-ajax.min.js"
This file
Through debugging tracking, we found that MVC has filtered out the ". min. js" file internally.
Decompile the DLL file
The following decompiled code is displayed:
public static void AddDefaultIgnorePatterns(IgnoreList ignoreList) { if (ignoreList == null) { throw new ArgumentNullException("ignoreList"); } 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); }
From this we can know that MVC filters out the file with the suffix .intelliisense.js0000-vsdoc.js0000.debug.js0000.min.js0000.min.css by default, which is the reason why the. min. js file does not work.
The above is all the content of this article. I hope you will like it.