g18*_*18c 6 asp.net-mvc-4 twitter-bootstrap font-awesome
我正在使用MVC4并通过nuget添加了Bootstrap和Font Awesome.
我可以看到Bootstrap如何捆绑在via 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"));
}
Run Code Online (Sandbox Code Playgroud)
我有以下问题:
<link href="~/Content/font-awesome.min.css" rel="stylesheet" />
- 正确的方法是什么?Include("~/Content/bootstrap.css", "~/Content/bootstrap-responsive.css"))
?Sta*_*anK 10
您可以在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"));
}
Run Code Online (Sandbox Code Playgroud)
然后,您需要确保_layout.cshtml
渲染这些包(Bootstrap nuget可能没有为您完成此操作).
例如
@Styles.Render("~/Content/bootstrap")
// Or, if you made it it's own bundle
@Styles.Render("~/Content/font-awesome")
Run Code Online (Sandbox Code Playgroud)
如果您不想在bundle中包含〜/ Content/bootstrap-responsive.css,只需从Include
方法中删除此字符串即可.
归档时间: |
|
查看次数: |
16451 次 |
最近记录: |