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",
                .IncludeDirectory("~/Content/themes", "*.css", true)
                .IncludeDirectory("~/Content/themes", "*.png", true));

Adding in the


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


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

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.