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)

1
  • You might want to also consider this library. I'm biased of course but it sounds like what you want. nuget.org/packages/RxLoader
    – Razor
    Jun 23, 2013 at 2:21

1 Answer 1

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.

2
  • 3
    Is there any way to do this for single files?
    – TWilly
    May 21, 2014 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, 2014 at 19:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.