Sha256: a750abb0ba645f27a527f92227575d2302a7cf656f3d298853e882cc909bcd81

Contents?: true

Size: 910 Bytes

Versions: 9

Compression:

Stored size: 910 Bytes

Contents

// -----------------------------------------------------------------------------
// Block Logger
// -----------------------------------------------------------------------------

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

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

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

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

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

    // Initialize a new block map
    $new-block: ($block: ('elements': (), 'modifiers': ()));

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

    // Everything OK
    @return true;
}

Version data entries

9 entries across 9 versions & 1 rubygems

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