0

Is it possible to overwrite an existing varibale via a sent parameter?

Example: My CSS

/* ... */
@bg_color: purple;
@h_color: lighten(@bg_color,25);
#header { background: @bg_color; }
/* ... */

Now when I call:

$less->parse(array('bg_color' => 'blue'));

it has no effect. The variable will not be overwritten. The idea is to use the variable in the CSS as a "Fallback-Color"

Any ideas how I can force less.php to overwrite existing variables?

0

2 Answers 2

1

I think you calling the parse() method wrong, the current signature of git-master is:

function parse($str = null, $initialVariables = null) {

It's since the 3.x.x version, prior to that (2.0.0 tag) it had only the $str parameter, (actual change commit of that line is here).

As for overwriting: The way lessc parses your code is that it pushes the variables you give them in phpland and then reads the source less file. The source less file will always take precedence because of that, you can't load a less file for compilation and change variables in them within them before lessc generates output.

Sign up to request clarification or add additional context in comments.

Comments

0

The answer: less.php canot overwrite less-variables!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.