Category Archives: ASP.NET

Using jQuery UI with MVC Bundling

Utilizing MVC’s bundling abilities is a great way to minimize the bandwidth required to run your site. By automatically minifying and compressing css and js files into one “file” the browser downloads, the amount of time spent gathering required resources to render a page can be minimized.
I ran into an issue where jQuery UI’s calendar was requesting additional resources like png and css files from the server that MVC’s minification was not set to handle.

bundles.Add(new StyleBundle("~/Styles/Global").Include("~/Content/Site.css",
                "~/Content/Bootstrap/bootstrap.css")
                .IncludeDirectory("~/Content/themes", "*.css", true)
                .IncludeDirectory("~/Content/themes", "*.png", true));

Adding in the

IncludeDirectory

includes all css and png found in the directory on the server. The

true

parameter tells the method to recursively scan the folder for all files matching the wildcard.