asp.net-mvc-4 – MVC4中的Bootstrap和font-awesome
我正在使用MVC4并通过nuget添加了Bootstrap和Font Awesome.
我可以看到Bootstrap如何通过下面的BootstrapBundleConfig.cs(由nuget包添加)捆绑在一起: public static void RegisterBundles() { BundleTable.Bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include("~/Scripts/bootstrap*")); BundleTable.Bundles.Add(new StyleBundle("~/Content/bootstrap").Include("~/Content/bootstrap.css","~/Content/bootstrap-responsive.css")); } 我有以下问题: >对于font-awesome,我没有看到上面类似的捆绑代码用于注册所需的css文件,有没有,或者我只是链接到内容目录中的样式表< link href =“?/ Content / font-awesome.min.css“rel =”stylesheet“/> – 什么是正确的方法? 解决方法
您可以阅读有关捆绑如何在
asp.net站点上工作的更多信息.
似乎BootStrap nuget包已经为你做了一些捆绑.您可以将其修改为在现有捆绑包中包含Font Awesome,或者将其设置为自己的捆绑包 例如 public static void RegisterBundles() { BundleTable.Bundles .Add(new ScriptBundle("~/bundles/bootstrap") .Include("~/Scripts/bootstrap*")); // Either add it to the existing bundle BundleTable.Bundles .Add(new StyleBundle("~/Content/bootstrap") .Include("~/Content/bootstrap.css","~/Content/bootstrap-responsive.css","~/Content/font-awesome.css")); // Or make it it's own bundle BundleTable.Bundles .Add(new StyleBundle("~/Content/font-awesome") .Include("~/Content/font-awesome.css")); } 然后,您需要确保_layout.cshtml呈现这些包(Bootstrap nuget可能没有为您完成此操作). 例如 @Styles.Render("~/Content/bootstrap") // Or,if you made it it's own bundle @Styles.Render("~/Content/font-awesome") 如果您不想在捆绑包中包含?/ Content / bootstrap-responsive.css,只需从Include方法中删除此字符串即可. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- asp.net-mvc – 没有注册默认实例,无法自动确定类型
- asp.net – 在我的UpdatePanel完成加载DOM元素后,如何从我的
- asp.net-mvc – MVC DDD:可以将存储库与控制器中的服务一起
- asp.net-core – 具有取消令牌的自定义AspCore中间件
- asp.net – 获取浏览器和连接信息的页面
- asp.net-mvc-4 – 错误:在VS2012中将MVC4升级到MVC5
- asp.net – 可以手动将OData参数应用于`.AsQueryable()`的结
- asp.net-mvc – ASP.NET MVC Remote属性方法参数始终传递nu
- 如何在Asp.Net Mvc中进行Basecamp风格的账户?
- asp.net-mvc-3 – 向@ Html.ValidationSummary添加错误消息
- asp.net – 我应该在哪里放置scriptmanager
- asp.net – 在subversion提交时忽略的文件夹
- asp.net – 通过javascript从代码后面访问变量
- asp.net-mvc – 如何从asp.net mvc响应中删除s-m
- .net – 如何从ModelState键中删除前缀?
- asp.net-mvc – 将角色添加到ADFS IPrincipal
- asp.net-web-api – 间歇性“无法加载类型”Syst
- asp.net-mvc – ASP.NET MVC 6中的文件IO Close(
- 是否有来自asp.net的htmlencode / htmldecode的j
- asp.net-mvc-3 – 在WebGrid中向Header添加自定义