22

I try to get started with MVC SPA apps, and I noticed in BundleConfig the following:

 ScriptBundle("~/scripts/jquery-{version}.js")

How this works? What is {version} and where it it taken from?

And where can find more information this, how BundleConfig works and how to customize it?

Thanks

bzamfir
  • 4,698
  • 10
  • 54
  • 89
  • 1
    possible duplicate of [{version} wildcard in MVC4 Bundle](http://stackoverflow.com/questions/12029161/version-wildcard-in-mvc4-bundle) – Samuel Caillerie Apr 24 '13 at 08:47
  • 1
    Better answer here: http://stackoverflow.com/questions/12029161/version-wildcard-in-mvc4-bundle – Atters Mar 25 '14 at 00:00

3 Answers3

15

See the answers to this question.

Also, check out this link. The Bundling and Optimization section discusses the use of the {version} tag.

Community
  • 1
  • 1
Matt
  • 303
  • 2
  • 5
4

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.

John Papa
  • 21,880
  • 4
  • 61
  • 60
0

Although the above answers are sufficient enough, just wanted to show the technical detail mentioned in the answer link by Matt:

The -{version} basically maps to a version regex, or to be precise: (\d+(?:.\d+){1,3}).

HTH.

Tauseef
  • 2,035
  • 18
  • 17