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