Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Escaping string in less and passing variables

Tags:

css

less

By using Less I need to escape a string which LESS doesn’t recognize.

filter: ~"progid:DXImageTransform.Microsoft.gradient(startColorstr=#26ffffff, endColorstr=#24ffffff)";

At the same time I need to pass two variables startColor and endColor to this string

.get-ARGB(@startColor, @endColor){
    /* ARGB backgrounds for IE 7+8 (black background with 50% transparancy) */
    filter: ~"progid:DXImageTransform.Microsoft.gradient(startColorstr=@startColor, endColorstr=@endColor)";
}

Any ideas how can I do it?

like image 408
Lorraine Bernard Avatar asked Oct 18 '12 10:10

Lorraine Bernard


1 Answers

Use string interpolation:

   filter: ~"progid:DXImageTransform.Microsoft.gradient(startColorstr=@{startColor}, endColorstr=@{endColor})";
like image 111
Tumas Avatar answered Sep 20 '22 11:09

Tumas