8

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?

tereško
  • 58,060
  • 25
  • 98
  • 150
Shuping
  • 5,388
  • 6
  • 43
  • 66

3 Answers3

14

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

dark_ruby
  • 7,646
  • 7
  • 32
  • 57
9

Try clearing ignore list.

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

            // code cleared for clarity

        }
    }
Siva Kandaraj
  • 824
  • 7
  • 15
  • great! Thanks, I have more options now! – Shuping Nov 08 '12 at 23:34
  • 1
    Good quick fix to get back to work, but beware that some of your wildcard include patterns might pick up scripts you wouldn't want to include: see [this answer to a related question](http://stackoverflow.com/a/12005272/177710) for what the defaults in the `IgnoreList` are. – Oliver May 07 '13 at 21:46
3

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

More details: mvc4 bundler not including .min files

Community
  • 1
  • 1
webdeveloper
  • 17,174
  • 3
  • 48
  • 47
  • Thanks for pointing to that question, it helped me figure out what this `IgnoreList` contains by default. – Oliver May 07 '13 at 21:50