Closed mik13ST closed 3 years ago
I don't think this is going to be added, because it's the same reason you can't do:
@var: 2;
.button {
@var: @var + 2;
}
That is, Less's variables (and therefore properties) are declarative, and have a final value per scope. So they can't reference themselves, because that would set their final value, which is illogical.
You can, of course, do:
.button {
@color: whitesmoke;
background-color: @color;
&:hover {
background-color: darken(@color, 10%);
}
}
I wish Less property value lookup would begin the lookup on the previous row instead of the current row. It would make something like this possible:
Currently Less rejects to compile this with
Recursive property reference for $background-color
.I think that delaying the lookup to exclude the current line would make things like this possible. I also believe this is a desirable thing.
I want to achieve this without using any variables.
I tried asking a question on StackOverflow first to see if I am not missing something.