Sha256: a0071afcc53d7e941414212d10a5c2bc126fb8ed2a26aa579f5b42ea10a65a56

Contents?: true

Size: 1.03 KB

Versions: 8

Compression:

Stored size: 1.03 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);

    // Error checks
    $outside-check: _should-not-be-called-within('block', 'scope');

    // Return false in case error throwing is disabled
    @if $outside-check == false {
        @return false;
    }

    $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

8 entries across 8 versions & 1 rubygems

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