3

We are trying to get the ScriptBundle in MVC 4 to return the expanded list of javascript when debug = false in the web.config. By default the ScriptBundle will optimize the javascript into one call when debug=false.

Currently when you set debug=false in the web.config, a ScriptBundle will combine and minify the javascript files like this:

 <script src="/AAA/Scripts/a?dfkjghakjsdfhglkjasdhfkljasdf"></script>

We need the Scriptbundle, when debug=false, to output the javascript expanded, like this:

<script src="/AAA/Scripts/jquery.validate.unobtrusive.min.js"></script>
<script src="/AAA/Scripts/jquery.tipTip.js"></script>

Is there a way to turn off the Scriptbundle optimization?

Why? When we do a https redirect on the site, the ScriptBundle optimized script link doesn't work (we get 503 Forbidden on the link)

Norman H
  • 2,248
  • 24
  • 27
Ian Vink
  • 66,960
  • 104
  • 341
  • 555
  • You might want to also consider this library. I'm biased of course but it sounds like what you want. https://nuget.org/packages/RxLoader/ – Razor Jun 23 '13 at 02:21

1 Answers1

12

Try setting this in your BundleConfig.cs file where you are setting up the bundles:

BundleTable.EnableOptimizations = false;

See http://www.asp.net/mvc/tutorials/mvc-4/bundling-and-minification for more details.

Norman H
  • 2,248
  • 24
  • 27
  • 3
    Is there any way to do this for single files? – TWilly May 21 '14 at 18:27
  • Aside from bundling one file at a time, not that I am aware of. Might be a good question to submit all on its own and be clear that you are NOT looking for this solution. – Norman H May 21 '14 at 19:09