1

I am using Kendo UI in an MVC4 application. I've decided I want to move my CSS and JS references to bundles. I created a bundle like so:

bundles.Add(new StyleBundle("~/bundles/baseCSS").Include(
            "~/Content/CSS/Shared/Site.css",
            "~/Content/CSS/plugins/jquery.jgrowl.css",
            "~/Content/Kendo/kendo.common.min.css",
            "~/Content/Kendo/kendo.blueopal.min.css"));

I reference the bundle in my _Layout.cshtml like so:

Styles.Render("~/bundles/baseCSS")

The HTML of my page (in debug mode) renders only the site.css and jquery.jgrowl.css references. If I rename the kendo CSS files and remove the "min" part of their name and change the string in my bundle, it works fine. Why can't I reference a .min?

Also, I have explicitly disabled optimization in the BundleConfig.

Adam Modlin
  • 2,994
  • 2
  • 22
  • 39
  • It uses `min` as needed when you build for debugging. When you build for release it uses `min`. By putting `min` in your config it is likely looking for `min.min`. Here's a post with lots of info http://stackoverflow.com/questions/11980458/bundler-not-including-min-files – Jasen May 21 '13 at 18:48
  • Thanks Jasen...this is exactly what I need. If you add a link as an answer I'll mark it. – Adam Modlin May 21 '13 at 19:08

2 Answers2

4

It uses min as needed when you build for debugging. When you build for release it uses min. By putting min in your config it is likely looking for min.min.

Here's a post with lots of info Bundler not including .min files

Community
  • 1
  • 1
Jasen
  • 14,030
  • 3
  • 51
  • 68
  • Indeed. That's pretty much the whole point of Bundles: you work with the unminified source broken up into as many files as you need to organize your project and Visual Studio bundles them all up into a single file for you when publishing release. – Chris Pratt May 21 '13 at 20:26
1

In a bundle you can not use min because when you add a css or js file in bundle it automatically minify the file.

You can reference the file directly from your layout such as..

<link rel="stylesheet" href="~/Content/Kendo/kendo.common.min.css" />

Or you can remove the .min extension from your file name and then add to the bundle such as..

bundles.Add(new StyleBundle("~/bundles/baseCSS").Include(
            "~/Content/CSS/Shared/Site.css",
            "~/Content/CSS/plugins/jquery.jgrowl.css",
            "~/Content/Kendo/kendo.common.css",
            "~/Content/Kendo/kendo.blueopal.css"));
Hasib Tarafder
  • 5,773
  • 3
  • 30
  • 44