【发布时间】:2014-05-05 19:04:20
【问题描述】:
我正在创建一个样式包:
bundles.Add(new StyleBundle("~/content/bundled-styles.css").Include(
"~/content/flexisel-style.css"));
...在我看来:
@Styles.Render("~/content/bundled-styles.css")
如果我在未启用优化的情况下查看我的页面(即BundleTable.EnableOptimizations = false;),那么一切正常。我的 .css 文件被添加到页面没有任何问题,它包含所有样式。
如果我设置 BundleTable.EnableOptimizations = true;(不更改 anything else)然后生成的 .css 包不包含任何样式。捆绑的 .css 文件与生成的令牌一起添加到页面中,但是当我从页面源单击 .css 文件时,它完全是空白的。然后我的页面显然没有任何样式呈现。
附加信息:
- 我的内容文件夹中没有名为“bundled-styles.css”的文件或文件夹
- 这是我要添加的唯一捆绑包。
- 我没有收到任何错误(如 404)。 .css 文件只是空的。
- 我正在使用 ASP.NET MVC 5。
【问题讨论】:
-
尝试删除虚拟路径
"~/content/bundled-styles.css"到"~/content/css"上的文件和扩展名 -
@Shoe 感谢您的建议,但没有运气。同样的问题。
标签: asp.net-mvc-5 bundling-and-minification