libsass icon indicating copy to clipboard operation
libsass copied to clipboard

@extend not honoring nested selectors

Open forestbelton opened this issue 12 years ago • 7 comments

When trying to compile the following SASS:

.a {
  & > .child {
    color: #fff;
  }
}

.b { @extend .a; }

I get the following output from libsass 1.0.1 / SassC (installed via brew):

.a > .child {
  color: #fff; }

which disagrees with the output from sass (version 3.2.1):

.a > .child, .b > .child {
  color: #fff; }

Is this expected?

forestbelton avatar Apr 18 '14 20:04 forestbelton

@forestbelton i think this is fixed now. You may need to get the latest sassc version and recompile with the latest libsass. I was having this same issue with an older compiled version but I just recompiled everything today and it seems to be working. I was also testing this out on sassmeister which now supports libsass. The output there seems to be what you're trying to accomplish.

hellatan avatar Apr 19 '14 20:04 hellatan

whoops. i accidentally had sass 3.3.5 used for compiling the output. Correctly using the libsass option, the output is more like this:

.a > .child, .a > .b, .a > .b {
    color: #fff;
}

it is strange that it does output the same .a > .b selector twice.

hellatan avatar Apr 19 '14 20:04 hellatan

Yeah, even stranger, since the output is not only missing selectors but outputting wrong ones too.

forestbelton avatar Apr 20 '14 02:04 forestbelton

here a gist to reproduce the error: https://gist.github.com/nongio/a04a0bdbdb87c3e36fe4

nongio-zz avatar Jun 16 '14 08:06 nongio-zz

Is anyone working on this issue? I would like to start contribute. If there is any WIP I would like to give my help.

nongio-zz avatar Jun 19 '14 09:06 nongio-zz

#146 seems to be where all the @extend-related action is.

zakj avatar Jun 26 '14 22:06 zakj

Extends is currently implemented incorrectly. There is a $1.2k bounty on issue #146 which covers this broken test case (and many others). I'm closing this to focus on the other issue. If you'd like to submit your code to the sass-spec repo, it could be very useful to help know we've nailed the new implementation.

HamptonMakes avatar Jul 21 '14 09:07 HamptonMakes