Bundling and not bundling in production and test environments in ASP.NET MVC <p>I am using the ASP.NET Bundling mechanism:</p> <pre><code> BundleTable.Bundles.Add(new ScriptBundle("~/Scripts/Master-js").Include( "~/Scripts/respond.min.js", "~/Scripts/jquery.form.js", "~/Scripts/jquery.MetaData.js", "~/Scripts/jquery.validate.js", "~/Scripts/bootstrap.js", "~/Scripts/jquery.viewport.js", "~/Scripts/jquery.cookie.js" )); </code></pre> <p>I want this to happen if the build is in release. If the build is in debug, I want the un-minified individual files to load so debugging would be easy.</p> <p>The only way I have been able to do this is to write the following in my view:</p> <pre><code> &lt;% if(HttpContext.Current.IsDebuggingEnabled) { Response.Write("&lt;script type='text/javascript' src='../../Scripts/respond.min.js'&gt;&lt;/script&gt;"); Response.Write("&lt;script type='text/javascript' src='../../Scripts/jquery.form.js'&gt;&lt;/script&gt;"); Response.Write("&lt;script type='text/javascript' src='../../Scripts/jquery.MetaData.js'&gt;&lt;/script&gt;"); Response.Write("&lt;script type='text/javascript' src='../../Scripts/jquery.validate.js'&gt;&lt;/script&gt;"); Response.Write("&lt;script type='text/javascript' src='../../Scripts/bootstrap.js'&gt;&lt;/script&gt;"); Response.Write("&lt;script type='text/javascript' src='../../Scripts/jquery.viewport.js'&gt;&lt;/script&gt;"); Response.Write("&lt;script type='text/javascript' src='../../Scripts/jquery.cookie.js'&gt;&lt;/script&gt;"); } else { Scripts.Render("~/Scripts/Master-js"); } %&gt; </code></pre> <p>As you can see, I am repeating myself here. Is there a better way?</p>