1

I am trying to add a Scripts bundle to my MVC site. At first I explicitly named the files:

var scripts = new ScriptBundle("~/scripts/bundle")
    .Include("~/scripts/jquery-2.1.3.min.js")
    .Include("~/scripts/jquery.validate-1.13.0.min.js")
    .Include("~/scripts/jquery.validate.unobtrusive.min.js");

bundles.Add(scripts);

This works as expected. However, I then decided it would be easier to just include the whole directory:

var scripts = new ScriptBundle("~/scripts/bundle")
    .IncludeDirectory("~/scripts", "*.js", true);

bundles.Add(scripts);

This second approach does not output anything when calling @Scripts.Render(), so I can only assume the IncludeDirectory method has not found anything. What am I doing wrong?

Edit: I have also tried the wildcard syntax

var scripts = new ScriptBundle("~/scripts/bundle")
    .Include("~/scripts/*.js");

This also fails to render anything

Alex
  • 7,639
  • 3
  • 45
  • 58
  • Hi AlexFoxGill, I believe that this http://stackoverflow.com/questions/11980458/bundler-not-including-min-files is solution for your problem. – BąQ May 07 '15 at 15:50

1 Answers1

1

Try:

var scripts = new ScriptBundle("~/scripts/bundle")
    .Include("~/scripts/*.js")
Arkadiusz Kałkus
  • 17,101
  • 19
  • 69
  • 108
  • Thanks for your suggestion but unfortunately this did not work either. It might help someone else though – Alex Feb 04 '15 at 15:43