Sha256: e803a9f3aa986ee34d844db7307db7bc120f21216248afb16281169d095e4dac

Contents?: true

Size: 965 Bytes

Versions: 1

Compression:

Stored size: 965 Bytes

Contents

// Support BEM syntax
// -------------------------------------------------------------------------------
// @param $selectors [string] : string of selectors to parse
// -------------------------------------------------------------------------------
// @return [string] : parsed list of selectors according to syntax

@function support-syntax-bem($selectors) {
    $selectors: string-to-list($selectors, "_");
    $parent: nth($selectors, 1);
    $selector-list: ($parent);

    // Loop over each selector and build list of selectors
    @each $selector in $selectors {
        // Make sure current selector is not the parent
        @if $selector != $parent {
            // Save to selector list
            $selector-list: append($selector-list, ($parent + "__" + $selector), "comma");
            // Define new parent
            $parent: $parent + "__" + $selector;
        }
    }

    // Return the list of transformed selectors
    @return $selector-list;
}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
flint-gs-1.6.0 stylesheets/flint/functions/lib/_support-syntax-bem.scss