I'm trying to use bundling to combine & minify some CSS files. In my Global.aspx.cs Application_Start
I have the following:
var jsBundle = new Bundle("~/JSBundle", new JsMinify());
jsBundle.AddDirectory("~/Scripts/", "*.js", false);
jsBundle.AddFile("~/Scripts/KendoUI/jquery.min.js");
jsBundle.AddFile("~/Scripts/KendoUI/kendo.web.min.js");
BundleTable.Bundles.Add(jsBundle);
var cssBundle = new Bundle("~/CSSBundle", new CssMinify());
cssBundle.AddDirectory("~/Content/", "*.css", false);
cssBundle.AddDirectory("~/Content/themes/base/", "*.css", false);
cssBundle.AddFile("~/Styles/KendoUI/kendo.common.min.css");
cssBundle.AddFile("~/Styles/KendoUI/kendo.default.min.css");
BundleTable.Bundles.Add(cssBundle);
And in my .cshtml file I have the following:
<link href="/CSSBundle" rel="stylesheet" type="text/css" />
<script src="/JSBundle" type="text/javascript"></script>
However, when I view the source of my bundles CSS file, it has the following:
/* Minification failed. Returning unminified contents.
(40,1): run-time error CSS1019: Unexpected token, found '@import'
(40,9): run-time error CSS1019: Unexpected token, found '"jquery.ui.base.css"'
.... lots more
Any ideas on how to resolve this?
I did narrow it down to the following line:
cssBundle.AddDirectory("~/Content/themes/base/", "*.css", false);
If I only have that line of code I get the same errors.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…