Answer the question
In order to leave comments, you need to log in
How to correctly remove values from an array in Stylus?
There is this piece of code:
$colors = {
'primary' : #124af5
'dark' : #222222
'white' : #ffffff
}
$colors-2 = $colors
remove($colors-2, 'primary')
Answer the question
In order to leave comments, you need to log in
The problem is that after the line, $colors-2 = $colors
both variables point to the same hash (array). Instead of this line, you need to write $colors-2 = merge({}, $colors)
to copy the contents $colors
into $colors-2
, and then it $colors-2
will already point to a copy, and not to the same hash. Something like this.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question