为什么我的风格束不能正确渲染ASP.NET MVC 4?

问题描述:

所以,我是新来的ASP.NET MVC 4(很好,我用了3一点点)。

So I am new to ASP.NET MVC 4 (well, I used 3 a little).

总之,在我BundleConfig.cs文件,我试图加载Twitter的引导css文件和一个额外的的site.css 文件。

Anyway, in my BundleConfig.cs file, I am trying to load the Twitter Bootstrap css files and an additional site.css file.

但是,只有文件的site.css渲染。我已经证实,自举css文件确实是在正确的位置(内容文件夹),是在相同的位置的site.css

But only the site.css file is rendered. I have confirmed that the bootstrap css files are indeed in the right place (Content folder) and are in the same location as the site.css

bundles.Add(new StyleBundle("~/Content/css").Include(
            "~/Content/bootstrap.min.css",
            "~/Content/bootstrap-responsive.min.css",
            "~/Content/site.css"));

修改

OK,这是不是我的preferred方式,但安德烈Drynov建议我尝试:

OK, this isn't my preferred way but Andrei Drynov recommended I try:

@import url("bootstrap.min.css")
body{background: #e8e6da;padding-top:60px;padding-bottom:40px;}
@import url("bootstrap-responsive.min.css")

但是,这并不工作。我改变了的site.css以上,但现在的背景车身颜色甚至不工作。如果我删除@imports背景是正确的颜色。

But that doesn't work. I changed the site.css to the above but now the background body color doesn't even work. If I remove the @imports the background is the correct color.

编辑2

我不明白这一点,但增加:

I don't get it but adding:

bundles.IgnoreList.Clear();

要我的包文件固定它。嗯。不知道我理解。但我能清除@imports出的site.css的。

To my bundles file fixed it. Hmmm. Not sure I understand. But I was able to remove the @imports out of the site.css.

奇怪的。

默认行为是IgnoreList忽略任何缩小的脚本。

The default behaviour is for the IgnoreList to ignore any minified scripts.

您可以从它们的名字中删除.min,或清除IgnoreList。

You can either remove the '.min' from their names, or clear the IgnoreList.