leafo / scssphp

SCSS compiler written in PHP
MIT License
1.34k stars 214 forks source link

Parent selector interpolation not working? #614

Closed zlobec closed 5 years ago

zlobec commented 5 years ago

I have the v0.7.6 and the parent selector interpolation is not working when defined as:

display {
   $prefix: &;
   @at-root {
     [class^="#{$prefix}"] {
     text-transform: uppercase;
   }
 }
}

I get the error: parse error: failed at $c: &; (stdin)

I managed to get the workaround, but I need to define the parent as a string variable.

display {
   @at-root {
     $prefix: display;
     [class^="#{$prefix}"] {
       text-transform: uppercase;
     }
   }
}

Or I'm i doing something wrong? Thanks for the response.

James90 commented 5 years ago

I have a similar problem with v0.7.7 and twbs/bootstrap v4.2.1.

Error: parse error: failed at `&} {` in mixins/_badge.scss on line 5:

@mixin badge-variant($bg) {
  color: color-yiq($bg);
  background-color: $bg;

  @at-root a#{&} {
    @include hover-focus {
      color: color-yiq($bg);
      background-color: darken($bg, 10%);
    }
  }
}
joelennon commented 5 years ago

Having the same issue as @James90 with Bootstrap 4.2.1. As a temporary fix we have rolled back to Bootstrap 4.1.3.

Cerdic commented 5 years ago

This is fixed in last version with #643

Cerdic commented 5 years ago

(can be closed @robocoder)