Include all files in a folder in a single bundle

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));

Leave a Comment