【发布时间】:2016-12-10 15:41:17
【问题描述】:
我有一个问题,即生产中的 MVC4 中的捆绑以某种方式捆绑了我的项目中不再拥有的旧版本的 Bootstrap。
我更新了 Bootstrap 的版本,因为我想使用一些我项目中旧版本不支持的 Glyphicons。
在本地以调试或发布模式运行,所有 Glyphicon 都按预期显示,但一旦部署到生产环境(使用 msbuild 部署到 Azure Web App),新的 Glyphicon 将丢失,并且缩小 + 捆绑的 css 文件丢失对较新的 Gyphicons 的引用 - 它本质上是 bootstrap.css 的旧版本
这是我的 RegisterBundles 方法:
public static void RegisterBundles(BundleCollection bundles)
{
bundles.UseCdn = false;
// Clear out the list and add back the ones we want to ignore.
// Don't add back .debug.js.
bundles.IgnoreList.Clear();
bundles.IgnoreList.Ignore("*-vsdoc.js");
bundles.IgnoreList.Ignore("*intellisense.js");
bundles.Add(new StyleBundle("~/style/global").Include(
"~/Content/css/lib/bootstrap.css",
"~/Content/css/global.css"));
}
那我用...
@Styles.Render("~/style/global")
包含样式。
【问题讨论】:
-
您能否确认您的 Azure Web 应用中确实存在较新的版本?
-
是的,如果我点击 /Content/css/lib/bootstrap.css 新版本确实会下载。
-
作为一个实验试试这个:
bundles.ResetAll(); BundleTable.EnableOptimizations = false;bundles.Add(...)之前 -
今晚才能测试部署,但我会尝试然后报告。谢谢。
-
这行得通,但是设置 EnableOptimizations = false 显然会阻止它捆绑,所以它只是提供原始 css 文件。
标签: asp.net-mvc twitter-bootstrap asp.net-mvc-4 bundling-and-minification