Conditional minification for specific packages using System.Web.Optimizations

I am using System.Web.Optimizations BundleConfig in my project. I am facing a problem with a specific jQuery plugin that I am using on my site. If I add the file to my ScriptBundle, it works fine in debug mode, but throws JavaScript errors when I'm in release mode (i.e., set Web.config debug = false). I think something is being misjudged.

All other scripts give me no problem, so I don't want to influence the behavior for all packages, but is there a way to configure for a specific package to tell it to use a specific version in debug and a min version in release.

I know the default behavior is to search for .min files, but I just can't seem to get this to work. Can anyone tell me what I am missing here? Thank you for your help.

Here's an example I shared myself. This works in debug, but not when I set debug = false in web.config

ScriptBundle layoutBundle = new ScriptBundle("~/jsbundles/jquery/layout"); 
layoutBundle.Include("~/Scripts/plugins/jquery.layout-latest.js"); 
bundles.Add(layoutBundle); 

      

+3


source to share


1 answer


If you just want to disable minification for one bundle, you can simply switch to the regular bundle instead of the ScriptBundle and it will not be minified. It will then serve that package in whatever form you include, without running it through mining.



+4


source







All Articles