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 Commented 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.

Sign up to request clarification or add additional context in comments.

2 Comments

Is there any way to do this for single files?
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.

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.