Sha256: b83a46ad1c3ca6f5d2589c3a96cd3085474c1261366a88faa3bc35bebc7b03fe

Contents?: true

Size: 880 Bytes

Versions: 9

Compression:

Stored size: 880 Bytes

Contents

// -----------------------------------------------------------------------------
// Scope Logger
// -----------------------------------------------------------------------------

/// Find if a given $scope has already been created
/// @param {String} $scope - Name of the scope

@function scope-exists($scope) {
    @return map-has-key($_bem-log, $scope);
}

/// Log the new $scope
/// @param {String} $scope - scope name

@function _bem-log-scope($scope) {

    // Check if the scope has already been created
    @if scope-exists($scope) {
        @if $bem-throw-errors {
            @error '`#{$scope}` scope has already been created';
        }

        @return false;
    }

    // Initialize a new scope map
    $new-scope: ($scope: ());

    // Update bem log with new scope
    $_bem-log: map-merge($_bem-log, $new-scope) !global;

    // Everything OK
    @return true;
}

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
bem-constructor-1.0.0 stylesheets/logger/_scope-logger.scss
bem-constructor-0.9.0 stylesheets/logger/_scope-logger.scss
bem-constructor-0.8.0 stylesheets/logger/_scope-logger.scss
bem-constructor-0.7.1 stylesheets/logger/_scope-logger.scss
bem-constructor-0.7.0 stylesheets/logger/_scope-logger.scss
bem-constructor-0.6.0 stylesheets/logger/_scope-logger.scss
bem-constructor-0.5.0 stylesheets/logger/_scope-logger.scss
bem-constructor-0.4.0 stylesheets/logger/_scope-logger.scss
bem-constructor-0.3.2 stylesheets/logger/_scope-logger.scss