A page created using ASP.NET MVC 2 takes 1.7 seconds to load. It contains 13 js files as shown below. Firebug shows that each js file download returns a 304 response, but since there are 13 files, this can significantly increase the page load time. Audit red warning warning Chrome merges js files.
How to combine them into one file using ASP.NET MVC 2 automatically or in another way to reduce load time? The project must have separate js files so that they can be replaced, but they should have been delivered as possibly as a single js file.
jqgrid, jquery, jquery-ui, tinymce and some jQuery jQuery files are used as shown below. Used by Visual Web Developer Express 2010. The application runs under Mono 2.10 / Apache and under Windows / IIS
site.master contains:
<%@ Master Language="C#" Inherits="System.Web.Mvc.ViewMasterPage" %> <!DOCTYPE html> <html> <head runat="server"> <meta charset="utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=0.1" /> <link rel="stylesheet" href="../../themes/redmond/jquery-ui-1.8.12.custom.css" type="text/css" /> <link href="../../Scripts/jqgrid/css/ui.jqgrid.css" rel="stylesheet" /> <link href="../../Content/Css/Site.css" rel="stylesheet" /> <asp:ContentPlaceHolder ID="HeadContent" runat="server" /> <title> <asp:ContentPlaceHolder ID="TitleContent" runat="server" /> </title> <script type="text/javascript"> "use strict"; var BASE_URL = '<%= ResolveUrl("~/") %>'; </script> <script src="<%= Url.Content("~/Scripts/jquery/jquery-1.7.1.js")%>" type="text/javascript"></script> <script src="<%= Url.Content("~/Scripts/jquery-ui-git.js")%>" type="text/javascript"></script> <script src="<%= Url.Content("~/Scripts/i18n/jquery.ui.datepicker-et.js")%>" type="text/javascript"></script> <script src="<%= Url.Content("~/Scripts/jquery.contextmenu-fixed2.js")%>" type="text/javascript"></script> <% if (CurUser.GetLanguage() == "EST") { %> <script src="<%= Url.Content("~/Scripts/jqgrid/js/i18n/grid.locale-et.js")%>" type="text/javascript"></script> <% } else { %> <script src="<%= Url.Content("~/Scripts/jqgrid/js/i18n/grid.locale-en.js")%>" type="text/javascript"></script> <% } %> <script type="text/javascript"> $.jgrid.no_legacy_api = true; $.jgrid.useJSON = true; </script> <script type="text/javascript" src="<%= Url.Content("~/Scripts/jqgrid/jquery.jqGrid.src-multiselect1-deleteandsortpatches.js")%>"></script> <script type="text/javascript" src="<%= Url.Content("~/Scripts/jqgrid/jQuery.jqGrid.dynamicLink.js")%>"></script> <script src="<%= Url.Content("~/Scripts/json2.js")%>" type="text/javascript"></script> <script src="<%= Url.Content("~/Scripts/jquery.form.js")%>" type="text/javascript"></script> <script src="<%= Url.Content("~/Scripts/TinyMCE/tiny_mce_src.js")%>" type="text/javascript"></script> <script src="<%= Url.Content("~/Scripts/TinyMCE/jquery.tinymce.js")%>" type="text/javascript"></script> <script src="<%= Url.Content("~/Scripts/myscripts.js")%>" type="text/javascript"></script> <script type="text/javascript"> var $grid; $(function() { "use strict"; <% if (TempData["Message"]!=null) { setTimeout( function() { showMessage ( '<%= TempData["Message"] as string %>'); ...
Update
I tried Oleg's suggestion in response, but got an error. jQuery is undefined as shown in the image below. How to fix it? IE console does not show any errors.

source share