简体   繁体   English

捆绑和缩小查找错误文件

[英]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. 我在解决方案中拥有的文件是: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. 我部署时网站正在寻找的文件是: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. 它不使用最新的,但是在那里,因此,如果将jquery更新为最新的,则不必重新编译。 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:" 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在该链接中,乔恩·加洛韦(Jon Galloway)说:“与此相关的我最喜欢的部分是,我们可以制作能够容纳脚本名称中版本号的捆绑软件,因此可以更新jQuery(如果需要很棒)不需要任何代码/标记更改:”

The {version} pattern is just a regex basically, so it will match and include all versions of jquery currently. {version}模式基本上只是一个正则表达式,因此它将匹配并包括当前所有版本的jquery。 We will definitely consider adding something like {highest-version} in the future. 我们绝对会在将来考虑添加类似{highest-version}的内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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