【发布时间】:2013-07-22 21:14:34
【问题描述】:
我的 BundleConfig.cs 文件中有以下内容
bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/reset.css",
"~/Content/site.css"));
在我的 _Layout.cshtml 文件中,我设置了这样的样式
@Styles.Render("~/Content/css")
当我在 web.config 文件中将 debug 设置为 false 时,我在 html 源代码中得到了这个
<link rel="stylesheet" href="/Content/css?v=o98MVeaPnTOPDtb6WAqw14YyALxEnOYDmGqwfyBAiq01">
The resource from this url is not text: http://localhost:1135/Content/css?v=o98MVeaPnTOPDtb6WAqw14YyALxEnOYDmGqwfyBAiq01
</link>
并且没有任何样式被应用。我在这里错过了什么?
【问题讨论】:
-
不确定 iis express 或 vs server 是否正确输出 mime 标头。直接引用css文件,看看headers是否仍然正确。
-
嗨罗伯特,我的 Content 文件夹中似乎有一个名为 Css 的文件夹。当我更改名称 Css-->Styles 时,一切正常;o)
-
奇怪,我在这里使用 /content/css 和 /content/js,一切正常(但不要使用捆绑)。可能是需要报告的与捆绑相关的错误
标签: asp.net-mvc-4 bundling-and-minification