Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET ScriptBundle does not work with .min.js?

I can successfully include jquery library with ScriptBundle from ASP.NET MVC by using below

bundles.Add(new ScriptBundle("~/bundles/jquery").Include("~/Scripts/jquery-1.7.1.js"));

However, If I changed to the minimized library, I could not get it from browser

bundles.Add(new ScriptBundle("~/bundles/jquery").Include("~/Scripts/jquery-1.7.1.min.js"));

anything wrong with the code?

like image 460
Shuping Avatar asked Nov 06 '12 07:11

Shuping


3 Answers

Unless EnableOptimizations is true or the debug attribute in the compilation Element in the Web.config file is set to false, files will not be bundled or minified. Additionally, the .min version of files will not be used, the full debug versions will be selected. EnableOptimizations overrides the debug attribute in the compilation Element in the Web.config file

more info

like image 77
dark_ruby Avatar answered Nov 05 '22 10:11

dark_ruby


Try clearing ignore list.

public class BundleConfig
    {
        public static void RegisterBundles(BundleCollection bundles)
        {
            bundles.IgnoreList.Clear();

            // code cleared for clarity

        }
    }
like image 9
Siva Kandaraj Avatar answered Nov 05 '22 09:11

Siva Kandaraj


Everything OK with your code, that's how it works, you can try change ignoreList.

More details: mvc4 bundler not including .min files

like image 3
webdeveloper Avatar answered Nov 05 '22 08:11

webdeveloper