I would like to add multiple style declaration using lessphp. I have provide the $context array with the lessphp setVariables method.
$context['font'] = 'color: #ffffff; font-family: verdana;';
Then I would like to use it in the less file with the variable name, like this:
.selector{
@font;
}
This doesn't work, what should be the appropriate way of handle this?
There are at least two issues with what you are trying to do based on both LESSphp and LESS syntax:
So I believe a solution for you is something like this:
PHP
$context = array(
"fontColor" => "#ffffff",
"fontFamily" => "verdana"
);
$less->setVariables($context);
LESS
The above code should generate in the compiled LESS file the equivalent of this:
@fontColor: #ffffff;
@fontFamily: verdana;
Which then you use like this:
.selector {
color: @fontColor;
font-family: @fontFamily;
}