Answer the question
In order to leave comments, you need to log in
scss how to remove selector?
selector-replace('.a .b .c .d', '.a', '');
This design doesn't work. How can I remove the selector by name?
There is such a function for deleting by index:
@function remove-selector($sel) {
@return '';
}
@function selector-nth($sel, $n, $f, $args...) {
$collector: ();
@each $s in $sel {
$modified: call($f, nth($s, $n), $args...);
$collector: append($collector, set-nth($s, $n, $modified), comma);
}
@return $collector;
}
selector-nth('.a .b .c .d', -2, remove-selector)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question