Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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

like image 466
bzamfir Avatar asked Apr 24 '13 08:04

bzamfir


People also ask

Which code is used to add jQuery in _layout Cshtml file?

The jquery code is in _Layout,cshtml.

HOW include jQuery in ASP NET MVC?

After the ASP.NET MVC Framework is installed a new ASP.NET MVC Web Application project should be created. Next, download jQuery, get the Packed or Minified version and place it into the Content folder of the the new web application project. Add a reference to the jQuery file put in the Content folder.

What is a script bundle?

The ScriptBundle class represents a bundle that does JavaScript minification and bundling. You can create style or script bundles in BundleConfig class under App_Start folder in an ASP.NET MVC project.

How add JS file to MVC project?

Go to Views -> Shared -> _Layout. cshtml file and add the render code. Make sure to register the custom javascript file after the jquery bundle since we are going to use jquery inside our js file. Otherwise we will get a jquery error and also register this before the script RenderSection.


1 Answers

See the answers to this question.

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

like image 124
Matt Avatar answered Oct 11 '22 19:10

Matt