Как пройти через директиву содержания от sass mixin? - PullRequest
0 голосов
/ 02 июля 2019

Я пытаюсь написать миксин SASS, чтобы динамически перебирать количество элементов в элементе, а затем применять собственную анимацию.

// MIXIN
@mixin staggerAnimation($el: $animated-elem) {
    @for $i from 1 through 4 {
        #{$el}:nth-child( #{$i} ) {
            @content
        }
    }
}

// Usage from external SASS file
$animated-elem: '.item';
@include staggerAnimation($animated-elem) {
    // This property needs to be different based on the usage
    animation: FadeIn 1s #{$el * 0.35}s ease 1 both;
}
...