Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrapping blocks with nested elements with a container class #11

Open
szalonna opened this issue Mar 9, 2017 · 0 comments
Open

Wrapping blocks with nested elements with a container class #11

szalonna opened this issue Mar 9, 2017 · 0 comments
Assignees

Comments

@szalonna
Copy link

szalonna commented Mar 9, 2017

Hello!

We want to wrap blocks in container classes but we have some issues with nested elements.

Source:

@import "node_modules/sass-bem/_bem";

@mixin component_a {
    @include block('a') {
        content: 'a';
        @include element('b') {
            content: 'b';
            @include element('c') {
                content: 'c';
                @include at('e') {
                    content: 'e';
                }
            }
            @include at('f') {
                content: 'f';
            }
        }
    }
}

@include component_a();
.d {
    @include component_a();
}

Expected result:

.a {
  content: 'a'; }
  .a__b {
    content: 'b'; }
    .a__b .a__c {
      content: 'c'; }
      .a--e .a__b .a__c {
        content: 'e'; }
    .a--f .a__b {
      content: 'f'; }

.d .a {
  content: 'a'; }
  .d .a__b {
    content: 'b'; }
    .d .a__b .a__c {
      content: 'c'; }
      .d .a--e .a__b .a__c {
        content: 'e'; }
    .d .a--f .a__b {
      content: 'f'; }

What we got:

.a {
  content: 'a'; }
  .a__b {
    content: 'b'; }
    .a__b .a__c {
      content: 'c'; }
      .a--e .a__b .a__c {
        content: 'e'; }
    .a--f .a__b {
      content: 'f'; }

.d .a {
  content: 'a'; }
  .d .a__b {
    content: 'b'; }
    .d .a__b .d .a__c {
      content: 'c'; }
      .d .a--e .d .a__b .d .a__c {
        content: 'e'; }
    .d .a--f .d .a__b {
      content: 'f'; }

As you can see in the wrapped component the .d class appears multiple times between nested elements.

@zgabievi zgabievi self-assigned this Mar 10, 2017
@zgabievi zgabievi added the bug label Mar 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants