Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Include all files in a folder in a single bundle

When using BundleConfig is it possible to include all files of a folder including all the files of the childfolders (and their childfolders etc.)?

I found .IncludeDirectory() but it seems to only include the files of the folder itself, not the files of the subfolders.

like image 763
Jordan Axe Avatar asked Nov 10 '13 19:11

Jordan Axe


1 Answers

Use the overload of IncludeDirectory method which accepts bool searchSubdirectories as third parameter.

MSDN:

searchSubdirectories - Specifies whether to recursively search subdirectories of directoryVirtualPath.

Example:

bundles.Add(new ScriptBundle("~/bundles/scripts")
    .IncludeDirectory("~/Scripts", "*.js", true));
like image 143
Zabavsky Avatar answered Oct 15 '22 13:10

Zabavsky