作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我的元素中有多个 CSS 文件,我们正在捆绑这些文件。
当包含在捆绑中时,其中一个文件无法按预期工作,但取消捆绑后,它可以正常工作。
代码如下
var cssCustom = new StyleBundle("~/bundle/css")
.Include("~/Content/Kendo/kendo.default.min.css", new CssRewriteUrlTransformWrapper())
.Include("~/Content/Kendo/kendo.bootstrap.min.css", new CssRewriteUrlTransformWrapper())
.Include("~/Content/Kendo/kendo.dataviz.bootstrap.min.css", new CssRewriteUrlTransformWrapper())
.Include("~/Content/Kendo/kendo.dataviz.min.css", new CssRewriteUrlTransformWrapper())
.Include("~/Content/Kendo/kendo.default.mobile.min.css", new CssRewriteUrlTransformWrapper())
.Include("~/Content/Site.css", new CssRewriteUrlTransformWrapper())
.Include("~/Content/Folder/bootstrap.css", new CssRewriteUrlTransformWrapper())
.Include("~/Content/Folder/main.min.css", new CssRewriteUrlTransformWrapper())
.Include("~/Content/themes/fonts.css", new CssRewriteUrlTransformWrapper());
cssCustom.Orderer = new AsIsBundleOrderer();
cssCustom.Transforms.Add(new CssMinify());
bundles.Add(cssCustom);
BundleTable.EnableOptimizations = true;
public class CssRewriteUrlTransformWrapper : IItemTransform
{
public string Process(string includedVirtualPath, string input)
{
return new CssRewriteUrlTransform().Process("~" + VirtualPathUtility.ToAbsolute(includedVirtualPath), input);
}
}
bootstrap.css 包含在 bundle 中时不起作用。
感谢您的帮助。
最佳答案
Bootstrap.css 文件中有错误,缺少大括号。
成功了。
关于CSS 打包后搞砸了,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43789630/
我是一名优秀的程序员,十分优秀!