Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <ul> <li>Right click References then Manage NuGet Packages and add “Microsoft.AspNet.Web.Optimization” (or type <code>Install-Package Microsoft.AspNet.Web.Optimization</code> into the NuGet console).</li> <li>In your Web.config file, add the following to <code>&lt;system.webServer&gt;</code>, allowing the minified bundles to be served with extensionless URLs.</li> </ul> <pre class="lang-xml prettyprint-override"><code>&lt;handlers&gt; &lt;remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" /&gt; &lt;remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" /&gt; &lt;remove name="ExtensionlessUrlHandler-Integrated-4.0" /&gt; &lt;add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" /&gt; &lt;add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" /&gt; &lt;add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" /&gt; &lt;/handlers&gt; </code></pre> <ul> <li>In your App_Start folder, add a new class called BundleConfig.cs. It should look something like this:</li> </ul> <pre class="lang-cs prettyprint-override"><code>using System.Web; using System.Web.Optimization; namespace MvcApplication1 { public class BundleConfig { // For more information on Bundling, visit http://go.microsoft.com/fwlink/?LinkId=254725 public static void RegisterBundles(BundleCollection bundles) { bundles.Add(new ScriptBundle("~/bundles/jquery").Include( "~/Scripts/jquery-{version}.js")); bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include( "~/Scripts/jquery-ui-{version}.js")); bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include( "~/Scripts/jquery.unobtrusive*", "~/Scripts/jquery.validate*")); // Use the development version of Modernizr to develop with and learn from. Then, when you're // ready for production, use the build tool at http://modernizr.com to pick only the tests you need. bundles.Add(new ScriptBundle("~/bundles/modernizr").Include( "~/Scripts/modernizr-*")); bundles.Add(new StyleBundle("~/Content/css").Include("~/Content/site.css")); bundles.Add(new StyleBundle("~/Content/themes/base/css").Include( "~/Content/themes/base/jquery.ui.core.css")); } } } </code></pre> <ul> <li>Edit the above to add the script and stylesheet bundles you require then add the following lines to the using section and Application_Start in Global.asax.cs:</li> </ul> <pre class="lang-cs prettyprint-override"><code>//using section using System.Web.Optimization; //Application_Start BundleConfig.RegisterBundles(BundleTable.Bundles); </code></pre> <ul> <li>Replace your CSS and JavaScript and tags in _Layout.cshtml with calls to <code>@Styles.Render("~/Content/css")</code> and <code>@Scripts.Render("~/bundles/jquery")</code>, replacing the parameters with the names of the bundles you added to BundleConfig.cs. Make sure not to name any of the bundles the same as folders in your project.</li> </ul> <p>You should now be all set – read up on how to use the full featureset here: <a href="http://www.asp.net/mvc/overview/performance/bundling-and-minification" rel="noreferrer">http://www.asp.net/mvc/overview/performance/bundling-and-minification</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload