Sha256: 505fd19f55ec4b056cf73fc822f92cc8f7f3f267a0abea64d7a8cbd68c7b8d71

Contents?: true

Size: 1.28 KB

Versions: 2

Compression:

Stored size: 1.28 KB

Contents

// -----------------------------------------------------------------------------
// Error checks
// -----------------------------------------------------------------------------
// Table of contents:
// 1. Within
// 2. Outside

// -----------------------------------------------------------------------------
// 1. Within
// -----------------------------------------------------------------------------

/// Checks that it's being created within all of the passed $objs...
@function _should-be-called-within($objs...) {

    $found: false;

    @each $obj in $objs {
        @if map-get($_bem-current-context, $obj) != null {
            $found: true;
        }
    }

    @if not $found {
        @error 'It should be called within #{inspect($objs)}';
    }

    @return true;
}


// -----------------------------------------------------------------------------
// 2. Outside
// -----------------------------------------------------------------------------

/// Checks that it's being created outside all of the passed $objs...
@function _should-not-be-called-within($objs...) {

  $found: false;

  @each $obj in $objs {
    @if map-get($_bem-current-context, $obj) != null {
      $found: true;
    }
  }
  @if $found {
    @error 'It should not be called within #{inspect($objs)}';
  }

  @return true;
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bem-constructor-0.1.1 stylesheets/_error-checks.scss
bem-constructor-0.1 stylesheets/_error-checks.scss