asp.net-mvc-4 – 如何配置MVC的样式捆绑顺序?
|
我的网络应用程序正在使用一个设置有jquery-ui和jqgrid的大图标。
你可以想象这个覆盖文件必须包含在jquery-ui样式表和jqgrid样式表之后。 我把所有的样式表都整理成一个捆绑包 bundles.Add(new StyleBundle("~/Content/dark-hive/allstyles").Include(
"~/Content/dark-hive/jquery-ui-1.8.23.custom.css","~/Content/ui.jqgrid.css","~/Content/jquery-ui-fixes.css","~/Content/icons.css","~/Content/site.css"));
但它被渲染如此! <link href="/Content/dark-hive/jquery-ui-1.8.23.custom.css" rel="stylesheet"/> <link href="/Content/jquery-ui-fixes.css" rel="stylesheet"/> <link href="/Content/ui.jqgrid.css" rel="stylesheet"/> <link href="/Content/icons.css" rel="stylesheet"/> <link href="/Content/site.css" rel="stylesheet"/> 如何配置我的包以正确的顺序呈现? 更新 无论我做了什么,文件总是呈现不正确的。所以我尝试了一些愚蠢的,最后添加了jquery-ui-fixes.css和jquery-ui-1.8.23.custom.css。 突然我的命令是 <link href="/Content/jquery-ui-fixes.css" rel="stylesheet"/> <link href="/Content/dark-hive/jquery-ui-1.8.23.custom.css" rel="stylesheet"/> <link href="/Content/ui.jqgrid.css" rel="stylesheet"/> <link href="/Content/icons.css" rel="stylesheet"/> <link href="/Content/site.css" rel="stylesheet"/> 我将我的javascript文件重命名为jqueryuifixes.css,现在它的顺序保存在较低的js文件中。 我在想,如果一个样式表有一个名称,它首先被优先排列某些原因,它的顺序与其他文件一起维护。 如果有人可以解释这个,我会给他们支票。 解决方法如果您单独包含每个文件,则捆绑包将会尊重您的订单…var bundle = new Bundle("~/Content/dark-hive/allstyles",new StyleBundle());
bundle.Include("~/Content/dark-hive/jquery-ui-1.8.23.custom.css");
bundle.Include("~/Content/ui.jqgrid.css");
bundle.Include("~/Content/jquery-ui-fixes.css");
bundle.Include("~/Content/icons.css");
bundle.Include("~/Content/site.css");
bundles.Add(bundle);
UPDATE 即使使用明确的顺序,您会发现有一个非常方便的内置订购系统,首先在所有其他订单系统上订购特定的命名文件。要完全清除这一点,您可以使用: bundles.FileSetOrderList.Clear(); 您可以使用以下方式添加自己的定制订单: BundleFileSetOrdering ordering = new BundleFileSetOrdering("My Order");
ordering.Files.Add("jquery.js");
bundles.FileSetOrderList.Clear();
bundles.FileSetOrderList.Add(ordering);
本质上,有一个庞大的内置文件列表,在任何不在列表中的任何文件之前,它们将被放入一个特定的顺序 – 但这些选项可以让你控制。 (编辑:安卓应用网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- asp.net-mvc-3 – ASP.NET MVC 3 RTM项目中的这个错误是什么
- 如何在ASP.NET MVC中获得HttpResponse的引用?
- 获取ASP.NET中所有活动会话的列表
- asp.net – 我应该在.gitingore文件中包含.vs文件夹吗?
- asp.net-mvc – 使用AD的ASP.NET MVC表单Auth在本地工作但在
- Asp.Net何时删除过期的缓存项?
- 从wsdl文件更新asp.net WebService引用?
- 如何在ASP.net中取消事件冒泡?
- ASP.NET会员盐?
- asp.net-mvc-4 – 使用KNOCKOUT.JS和ASP.NET MVC 4进行级联
- asp.net-mvc – Razor视图与部分视图
- asp.net-mvc – 任何理由不信任ASP.NET AntiForg
- asp.net – 一个cookie文件的最大大小是多少?
- asp.net-mvc – 没有值的asp.net mvc htmlattrib
- asp.net-mvc – Razor视图引擎:复杂循环和HTML
- asp.net – 单元测试操作过滤器 – 如何模拟View
- asp.net – 如何在DLL中添加Web服务引用
- asp.net-mvc – 如何使用Html.DropDownList为默认
- asp.net-mvc – ASP.NET MVC – 在哪里抛出异常?
- asp.net – DataBinding Eval到2个小数位置不显示
