【问题标题】:ASP.NET Bundling and Minification - CSS3 properties failASP.NET 捆绑和缩小 - CSS3 属性失败
【发布时间】:2012-12-25 03:05:24
【问题描述】:

我有几个使用如下属性的 css 类:

.rfs_left_btn
{
width: 176px;
height: 20px;
background: #fefefe;
background: -moz-linear-gradient(top,  #fefefe 0%, #fafafa 48%, #f1f1f1 50%, #e9e9e9 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#fefefe), color-stop(48%,#fafafa), color-stop(50%,#f1f1f1), color-stop(100%,#e9e9e9));
background: -webkit-linear-gradient(top,  #fefefe 0%,#fafafa 48%,#f1f1f1 50%,#e9e9e9 100%);
background: -o-linear-gradient(top,  #fefefe 0%,#fafafa 48%,#f1f1f1 50%,#e9e9e9 100%);
background: -ms-linear-gradient(top,  #fefefe 0%,#fafafa 48%,#f1f1f1 50%,#e9e9e9 100%);
background: linear-gradient(top,  #fefefe 0%,#fafafa 48%,#f1f1f1 50%,#e9e9e9 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fefefe', endColorstr='#e9e9e9',GradientType=0 );
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px; /* Drop shadow*/
-webkit-box-shadow: 0px 1px 1px #cecece;
-moz-box-shadow: 0px 1px 1px #cecece;
box-shadow: 0px 1px 1px #cecece;
margin-bottom: 5px;
}

当像下面这样创建 StyleBundle 时:

StyleBundle bundle_cssSession = new StyleBundle("~/Css/bundle_session");
bundle_cssSession.Include("~/Styles/_catalog.css");   

System.Web.Optimization.Styles.Render("~/Css/bundle_session") 失败并出现以下错误:

/* 缩小失败。返回未缩小的内容。 (2196,14): 运行时错误 CSS1036: Expected expression, found '0' */

如果我删除多个“背景”属性(只保留其中一个),则缩小工作。

有没有一种解决方案可以将 StyleBundle 与上述 CSS3 属性一起使用?

谢谢。

【问题讨论】:

    标签: asp.net css minify


    【解决方案1】:

    优化命名空间中存在已知的错误,导致它在 CSS3 上失败。错误报告是herehere。我能提供的唯一建议是要么自己压缩它们,然后给样式包提供 .min 文件以在提供优化内容时使用,要么使用不同的缩小方法。

    【讨论】:

    • 非常感谢您的回答。我会研究mooncode解决方案。
    • 链接已经失效,所以答案在别处。
    • 我怀疑答案是否在其他地方,2017 年,MS 仍然没有修复它。我想我们要等 15 年才能让 CSS3 与他们的垃圾兼容
    【解决方案2】:

    也许,这可能是一种错误的模式(或“gambiarra”,就像我们在巴西所说的那样),但我修复了它,将渐变标签移动到内联。

    【讨论】:

      猜你喜欢
      • 2017-01-17
      • 2013-10-22
      • 2013-10-02
      • 1970-01-01
      • 2019-06-28
      • 2013-02-21
      • 1970-01-01
      • 2021-07-20
      • 2017-12-12
      相关资源
      最近更新 更多