在调试模式下运行我的MVC4应用程序(因此没有css/scripts最小化)运行正常。 一旦我不使用调试运行(css/scripts被最小化),我的Twitter Bootstrap图标就不会显示。 这里的另一个线程建议使用bundles.IgnoreList.Clear()。 但对我似乎不起作用。 我的BundleConfig.RegisterBundles(...)如下所示:
public static void RegisterBundles(BundleCollection bundles)
{
bundles.IgnoreList.Clear();
// Some JavaScript bundles only
// ...
bundles.Add(new StyleBundle("~/bundles/maincss").Include(
"~/Content/bootstrap.css",
"~/Content/bootstrap-responsive.css",
"~/Content/my.css"));
}
}
所有包都是使用Nuget安装的(正如我所说,在调试模式下它能够正常工作)。我的Content文件夹还包含两个bootstrap...css文件的缩小版本,但没有一个缩小版本的my.css。字形图标位于images子文件夹中。
我的_Layout.cshtml文件看起来像这样:
<head>
...
@Styles.Render("~/bundles/maincss")
</head>
我应该补充说明,通过“非调试”模式,我指的是在Web.config文件中设置debug =“false”选项:
<compilation debug="false" targetFramework="4.5" />
有人知道为什么 Twitter Bootstrap 图标在“非调试”模式下不显示吗?
谢谢 Rob