简体   繁体   中英

Bundling and Minification finding wrong file

So I'm having trouble all of a sudden where when I do my bundling and minification it pulls up the wrong file version.

bundles.Add(new ScriptBundle("~/bundles/jquery").Include("~/Scripts/jquery-{version}.js"));

bundles.Add(new ScriptBundle("~/bundles/scripts").Include(
                             "~/Scripts/bootstrap.js",
                             "~/Scripts/knockout-{version}.js",
                             "~/Scripts/jquery.signalR-{version}.js",
                             "~/Scripts/underscore.js",
                             "~/Scripts/Code/vLib.js"
                             ));

bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include(
                             "~/Scripts/jquery-ui-{version}.js"));

The files that I have in my solution are: jquery-1.8.3.js, jquery-ui-1.9.2.js, knockout-2.2.0.js, jquery.signalR-0.5.3.js.

The files that the website is looking for when I deploy are: jquery-1.7.2.js, jquery-ui-1.8.22.js, knockout-2.1.0.js, jquery.signalR-0.5.2.js.

My understanding is that when you use the version, it will look for the newest version....but I guess something is messed up.

Anyone have any thoughts?

It does not use the latest but is there so that you do not have to recompile if you update jquery to the latest. I believe it looks for the first file that meets the requirements.

http://weblogs.asp.net/jgalloway/archive/2012/08/16/asp-net-4-5-asp-net-mvc-4-asp-net-web-pages-2-and-visual-studio-2012-web-developer-features.aspx In that link Jon Galloway states "One of my favorite parts about this is that we can make bundles that accomodate version numbers in script names, so updating jQuery (maybe via NuGet if you're awesome) doesn't require any code / markup changes:"

The {version} pattern is just a regex basically, so it will match and include all versions of jquery currently. We will definitely consider adding something like {highest-version} in the future.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM