i got an array from php with below code
<script type="text/javascript">
var params = <?php echo json_encode($this->getParams());?>;
var variables = new Object();
for(var key in params){
variables[key] = "'" + params[key] + "'";
}
less.modifyVars(variables);
console.log(params);
console.log(variables);
</script>
from console params : Object {google_font: "Abel", icon: "custom/icon.icon"}
variables : Object {google_font: "'Abel'", icon: "'custom/icon.icon'"}
and in style.less
@bd_ggfont : @google_font;
body{
font-family: @bd_ggfont;
}
when i complie i get error messeger
NameError: variable @google_font is undefined
in style.less on line 7, column 8:
7@bd_ggfont : @google_font;
what is wrong ? thanks for any help !!
also i change key in params to @key like
variables['"@' + key + '"'] = "'" + params[key] + "'";
and i get error too!