Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET Bundling and Minification - CSS3 properties fail

I have few css clases that uses properties like below:

.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;
}

When creating a StyleBundle like below:

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

The System.Web.Optimization.Styles.Render("~/Css/bundle_session") fails with the following error:

/* Minification failed. Returning unminified contents. (2196,14): run-time error CSS1036: Expected expression, found '0' */

If I remove the multiple 'background' properties (and leave just one of them) the minification works.

Is there a solution to use the StyleBundle with CSS3 properties like the ones above?

Thank you.

like image 314
mmmmmm Avatar asked Jan 10 '13 16:01

mmmmmm


1 Answers

There are known bugs in the Optimization namespace that cause it to fail on CSS3. The bug reports are here and here. The only advice I can offer is to either compress them yourself and give the style bundle the .min file to use when serving optimised content or use a different minification method.

like image 185
Wolfwyrd Avatar answered Oct 20 '22 14:10

Wolfwyrd