当我将jquery ui添加到包中时,我最终得到:
bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/themes/base/jquery.ui.core.css",
"~/Content/themes/base/jquery.ui.resizable.css",
"~/Content/themes/base/jquery.ui.selectable.css",
"~/Content/themes/base/jquery.ui.accordion.css",
"~/Content/themes/base/jquery.ui.autocomplete.css",
"~/Content/themes/base/jquery.ui.button.css",
"~/Content/themes/base/jquery.ui.dialog.css",
"~/Content/themes/base/jquery.ui.slider.css",
"~/Content/themes/base/jquery.ui.tabs.css",
"~/Content/themes/base/jquery.ui.datepicker.css",
"~/Content/themes/base/jquery.ui.progressbar.css",
"~/Content/themes/base/jquery.ui.theme.css"
Internet Explorer有一个limit 31个样式表,它将加载,其中jquery已经占用12个。添加yui reset,base和fonts我已经有15个样式表,没有任何网站样式或插入的插件样式表。
显然,捆绑时一切正常,因为只生成了一个样式表。我的第一直觉是使用那些使用@Import,但这会导致捆绑到fall over或不缩小。
除了较少的样式表之外,最好的解决方法是什么?
我目前的解决方案是#if DEBUG
构造,但有更好的方法吗?
#if DEBUG
bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/themes/base/jquery.ui.all.css"));
#else
bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/themes/base/jquery.ui.core.css",
"~/Content/themes/base/jquery.ui.resizable.css",
"~/Content/themes/base/jquery.ui.selectable.css",
"~/Content/themes/base/jquery.ui.accordion.css",
"~/Content/themes/base/jquery.ui.autocomplete.css",
"~/Content/themes/base/jquery.ui.button.css",
"~/Content/themes/base/jquery.ui.dialog.css",
"~/Content/themes/base/jquery.ui.slider.css",
"~/Content/themes/base/jquery.ui.tabs.css",
"~/Content/themes/base/jquery.ui.datepicker.css",
"~/Content/themes/base/jquery.ui.progressbar.css",
"~/Content/themes/base/jquery.ui.theme.css"));
#endif
答案 0 :(得分:1)
如果您确实需要所有主题,只需在DEBUG和RELEASE模式中包含jquery.ui.all.css
。
bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/themes/base/jquery.ui.all.css"));
这种方式在DEBUG模式下,您可以获得一个CSS文件,在RELEASE模式下,您可以获得一个带有缓存头的单个压缩CSS文件。