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 – 停止在每次构建时创建和删除app_offline.htm?
- asp.net-mvc – 在MVC身份(2.0.1)中的regenerateIdentity/v
- asp.net-mvc – 使用部分页面的PagedList.MVC中的Ajax分页
- asp.net-mvc – 强大类型的ASP.NET MVC与ADO.NET实体框架
- asp.net – Page_Load中的Response.Redirect
- asp.net – 什么时候调用Application_End,我该如何手动导致
- asp.net – 什么时候不应该使用Web服务?
- asp.net – Linq对sql对象是否可序列化为会话状态?
- asp.net-mvc – @ Html.DropDownListFor如何添加选项?
- asp.net – 在button和asp之间的区别:button onclick
- asp.net-mvc – UnitOfWork in Action Filter似乎
- asp.net – 让Visual Studios使用子域名?
- 如何在asp.net用户控件中使用jQuery ajax?
- asp.net-mvc – ViewModels和渲染
- asp.net-mvc – 更改项目URL Visual Studio
- ASP.Net MVC如何将数据从视图传递到控制器
- asp.net-mvc-3 – MVC3视图继承不可能?
- asp.net-mvc – ASP.NET MVC是否允许私有ViewMod
- asp.net-mvc-3 – 在代码MVC Razor中呈现局部视图
- asp.net – 网络应用程序项目v.s.网站项目
