Created
May 1, 2022 07:28
-
-
Save delphinpro/e1626fcdfe6ebdd690259c5de284a787 to your computer and use it in GitHub Desktop.
Get last selector
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@function str-split($string, $separator: " ") { | |
$i: str-index($string, $separator); | |
@if $i != null { | |
@return append( | |
str-slice($string, 1, $i - 1), | |
str-split(str-slice($string, $i + str-length($separator)), $separator) | |
); | |
} | |
@return $string | |
} | |
@function nth-last($list) { | |
@return nth($list, length($list)); | |
} | |
@function get-last-selector($selector) { | |
@return nth-last(str-split(#{$selector})); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment