I am trying to use linking to combine and minimize 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 look at the source code of my CSS bindings 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"'
.... much more
Any ideas on how to resolve this?
I narrowed it down to the following line:
cssBundle.AddDirectory("~/Content/themes/base/", "*.css", false);
If I have only this line of code, I get the same errors.
c # asp.net-mvc bundle asp.net-optimization
Kyle Aug 15 2018-12-12T00: 00Z
source share