Sha256: 0aefd8c28a204e7587fd8c648d12c9c76b860799ecea75796e3dcbf99b6fe0fb

Contents?: true

Size: 1.04 KB

Versions: 5

Compression:

Stored size: 1.04 KB

Contents

// -----------------------------------------------------------------------------
// Scope constructor
// -----------------------------------------------------------------------------

/// Set namespace for scopes
/// @public

$bem-scope-namespace: 's';

/// Initializes a new scope object
/// @private
/// @param {String} $scope  - Name for the new scope
/// @returns The final selector for the new scope object

@function _scope($scope) {

    // Log new block
    $new-scope: _bem-log-scope($scope);

    // Check it's not called inside another scope
    // and it's called at the root-level
    $recursive-check: should-not-be-called-recursively('scope');
    $outside-check: should-not-be-called-within('block');

    $namespace: if($bem-use-namespaces, $bem-scope-namespace + '-', '');
    $selector: '.' + $namespace + $scope;

    $set-current: set-current-context('scope', $scope, $selector);

    @return $selector;
}

@mixin scope($scope) {

    @at-root #{_scope($scope)} {
        @content;
    }

    $unset-current: unset-current-context('scope');
}

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
bem-constructor-0.3.2 stylesheets/_scope.scss
bem-constructor-0.3.0 stylesheets/_scope.scss
bem-constructor-0.2.0 stylesheets/_scope.scss
bem-constructor-0.1.1 stylesheets/_scope.scss
bem-constructor-0.1 stylesheets/_scope.scss