Search code examples
asp.net-mvcasp.net-mvc-4asp.net-optimization

asp.net mvc script bundle adding all the files


When you add a script bundle and have something like:

bundles.Add(new ScriptBundle("~/bundles/base.scripts").Include(
                            "~/Scripts/jquery-1*"));

It loads up the raw Jquery version and the minified version. Those files are both in the Scripts folder so I assume the asterisk is doing exactly what you tell it.

Is there a way to have only the minified version render when in debug=false mode and the raw version in debug=true?

Or is it down to actually specifying the exactly files you want instead of using the asterisk?

Regards, Jacques


Solution

  • This should be happening automatically via the BundleCollection's FileExtensionReplacementList which should be selecting the .min version of the file when debug=false. The default templates when you create a new project should be using this functionality as well.