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
The jquery code is in _Layout,cshtml.
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.
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.
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.
See the answers to this question.
Also, check out this link. The Bundling and Optimization section discusses the use of the {version}
tag.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With