Reputation: 1863
I am using the ASP.Net 4.0 Bundling feature. In my ~/Scripts folder, I have several versions of jquery-xxx and jquery-ui-yyy. The xxx versions are 1.4.4, 1.6.4, 1.8.3, 1.9.1.
The yyy versions are 1.8.1, 1.8.custom, 1.9.2, 1.10.0.
Which ones are in effect in the following bundles table? Thanks.
public static void RegisterBundles(BundleCollection bundles)
{
#region JavaScript bundles
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js",
"~/Scripts/jquery-ui-{version}.js",
"~/Scripts/jquery.unobtrusive*",
"~/Scripts/jquery.validate*"));
Upvotes: 3
Views: 516
Reputation: 5487
As Slawomir says, it will include all versions.
If you have
bundles.Add(new ScriptBundle("~/bundles/foo").Include(
"~/Scripts/foo-{version}.js"));
And the following files in /Scripts
foo-1.js
foo-2.1.js
foo-32-1.100.js
If you add the following to your view:
You end up with rendered (in debug mode) html of:
//note that foo-1.js does not match
<script src="/Scripts/foo-2.1.js"></script>
<script src="/Scripts/foo-32.1.100.js"></script>
This provides an easy way to upgrade you scripts without having to recompile, but again as Slawomwir says, you will end up with all files matching that (\d+(?:\.\d+){1,3})
regex
Upvotes: 1
Reputation: 4073
{version}
will be replaced to pattern (\d+(?:\.\d+){1,3})
and all files that match that regex will be included.
Upvotes: 2