asp.net-mvc ScriptBundle 中的 {version} 是什么("~/scripts/jquery-{version}.js")
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16187333/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
what is {version} in ScriptBundle("~/scripts/jquery-{version}.js")
提问by bzamfir
I try to get started with MVC SPA apps, and I noticed in BundleConfig the following:
我尝试开始使用 MVC SPA 应用程序,并且在 BundleConfig 中注意到以下内容:
ScriptBundle("~/scripts/jquery-{version}.js")
How this works? What is {version} and where it it taken from?
这是如何工作的?什么是 {version} 以及它来自哪里?
And where can find more information this, how BundleConfig works and how to customize it?
在哪里可以找到更多信息,BundleConfig 如何工作以及如何自定义它?
Thanks
谢谢
采纳答案by Matt
See the answers to this question.
请参阅此问题的答案。
Also, check out this link. The Bundling and Optimizationsection discusses the use of the {version}tag.
另外,请查看此链接。该捆绑和优化部分讨论了使用的{version}标签。
回答by John Papa
It allows you to indicate a version number format (semver) that many libraries use. For example, you reference jquery-1.9.1 and then it goes to jquery-1.9.2. Using {version} you don't have to change your code, you just need to re build the bundle.
它允许您指示许多库使用的版本号格式(semver)。例如,您引用 jquery-1.9.1,然后它转到 jquery-1.9.2。使用 {version} 您不必更改代码,您只需要重新构建包。

