Reputation: 9808
Given this snippet, imagine it can be LESS or SASS changing $ by @
$lol: 1px !default;
$lil: $lol;
$lol: 8px;
.gg{
border-radius: $lil;
}
In SASS it compiles to
.gg {
border-radius: 1px;
}
In Less it compiles to:
.gg {
border-radius: 8px;
}
In my current situation, I prefer better how LESS implements it because the two first lines are in bootstrap lib and the third is supposed to overwrite the value of lil
.
How could I overwrite the $lil
variable in SASS by only changing the $lol
variable?
Upvotes: 0
Views: 59
Reputation: 646
Because the sass variable has the !default parameter assigned, even though you are later changing it to 8px, it doesnt get assigned to that in sass.
from the SASS documentation
You can assign to variables if they aren’t already assigned by adding the !default flag to the end of the value. This means that if the variable has already been assigned to, it won’t be re-assigned, but if it doesn’t have a value yet it will be given one.
Upvotes: 1