Srb*_*711 7 css c# asp.net-mvc bundle bundling-and-minification
我最近在一个网站上遇到了一个问题,网页上的样式确实搞砸了,但只在IE中.我的老板告诉我这可能是因为正在渲染的CSS Bundle包含来自不同目录的CSS文件,所以我检查了它.它类似于以下内容:
bundles.Add(new StyleBundle("~/path/subpath/all").Include(
"~/path/subpath/filename.css",
"~/path/subpath/filename1.css",
"~/path/subpath/filename2.css",
"~/path/subpath/filename3.css",
"~/path/subpath/anotherSubPath/filename.css",
"~/path/subpath/anotherSubPath/filename1.css",
"~/path/aDifferentSubPath/filename.css"));
Run Code Online (Sandbox Code Playgroud)
他说Bundling无法像这样工作,你必须只有Bundle中相同目录的文件,所以我把它们拆分成如下所示:
bundles.Add(new StyleBundle("~/path/subpath/all").Include(
"~/path/subpath/filename.css",
"~/path/subpath/filename1.css",
"~/path/subpath/filename2.css",
"~/path/subpath/filename3.css"));
bundles.Add(new StyleBundle("~/path/subpath/anotherSubPath/all").Include(
"~/path/subpath/anotherSubPath/filename.css",
"~/path/subpath/anotherSubPath/filename1.css"));
bundles.Add(new StyleBundle("~/path/aDifferentSubPath/all").Include(
"~/path/aDifferentSubPath/filename.css"));
Run Code Online (Sandbox Code Playgroud)
这在IE中解决了我们的问题.好的,现在我的问题:
对于旧版本的 IE,至少 < 10 有一些已知的限制
IE 可以加载的 CSS 和脚本文件的数量 - 如果您在Debug不捆绑捆绑包的模式下运行站点,这可能是一个问题。
如果情况并非如此,那么文件中是否有超过 4,096 个选择器???
| 归档时间: |
|
| 查看次数: |
1420 次 |
| 最近记录: |