My Stylus function has the following structure:
// Convenient way to create a top-down gradient background color
td_gradient(color1, color2)
background-color (color1 + (color2 - color1) / 2)
background -webkit-gradient(linear, 0% 0%, 0% 100%, from(color1), to(color2))
background -webkit-linear-gradient(top, color1, color2)
background -moz-linear-gradient(top, color1, color2)
background -ms-linear-gradient(top, color1, color2)
background -o-linear-gradient(top, color1, color2)
@css
{
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=color1, endColorstr=color2);
}
To avoid causing Stylus to crash, I had to place the Internet Explorer gradient style within the literal css scope @css
. This prevents Stylus from incorrectly interpreting the color1
and color2
variables within the css scope, which would break the style.
Is there a way to allow the css scope to properly parse variables? Alternatively, is there a method to include the filter style in Stylus without relying on the literal css scope?