Sha256: eea7e4330b394e4d0ac607681809d2bf3646646b7fcf0c826d52e2b88f997ace

Contents?: true

Size: 1.24 KB

Versions: 7

Compression:

Stored size: 1.24 KB

Contents

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

@function flint-support-syntax-bem($selectors) {
    // Clean up selector, remove double underscores for spaces
    //  add psudeo character to differentiate selectors
    $selectors: flint-replace-substring($selectors, "__", "/");
    // Parse string to list
    $selectors: flint-string-to-list($selectors, "/");
    // Define top-most parent of selector
    $parent: nth($selectors, 1);
    // Create new list of parsed selectors
    $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 parsed selectors
    @return $selector-list;
}

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
flint-gs-1.12.0 stylesheets/flint/functions/lib/_support-syntax-bem.scss
flint-gs-1.11.2 stylesheets/flint/functions/lib/_support-syntax-bem.scss
flint-gs-1.10.0 stylesheets/flint/functions/lib/_support-syntax-bem.scss
flint-gs-1.9.1 stylesheets/flint/functions/lib/_support-syntax-bem.scss
flint-gs-1.8.0 stylesheets/flint/functions/lib/_support-syntax-bem.scss
flint-gs-1.7.2 stylesheets/flint/functions/lib/_support-syntax-bem.scss
flint-gs-1.7.0 stylesheets/flint/functions/lib/_support-syntax-bem.scss