In the _Layout.cshtml file _Layout.cshtml by default, scripts are defined in the "environment" like this:
<environment names="Development"> <script src="~/lib/jquery/dist/jquery.js"></script> <script src="~/lib/bootstrap/dist/js/bootstrap.js"></script> <script src="~/js/site.js" asp-append-version="true"></script> </environment> <environment names="Staging,Production"> <script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-2.1.4.min.js" asp-fallback-src="~/lib/jquery/dist/jquery.min.js" asp-fallback-test="window.jQuery"> </script> <script src="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.5/bootstrap.min.js" asp-fallback-src="~/lib/bootstrap/dist/js/bootstrap.min.js" asp-fallback-test="window.jQuery && window.jQuery.fn && window.jQuery.fn.modal"> </script> <script src="~/js/site.min.js" asp-append-version="true"></script> </environment>
And below is @RenderSection("scripts", required: false)
I canβt imagine the section (in this case, "scripts") in any separate .cshtml file, since it looks like they got rid of the " @section " in Core
I would like to add specific scripts for certain views. What is the new way to do this? Am I just dumping everything in _Layout now?
Daath source share