سؤال

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)

هل كانت مفيدة؟

المحلول

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top