irundaia / sbt-sassify

sbt-web plugin for Sass files
Apache License 2.0
68 stars 17 forks source link

Core dump on nested @extend #11

Closed thepratt closed 8 years ago

thepratt commented 8 years ago

I noticed this when using the materialize 0.97.5 web jar. When @extend runs more than 1 level deep, everything dies in a core dump.

Inside the materialize _buttons.scss there is a nested include:

.btn {
  text-decoration:none;
  color: $button-color-raised;
  background-color: $button-color;
  text-align: center;
  letter-spacing: .5px;
  @extend .z-depth-1;
  transition: .2s ease-out;
  cursor: pointer;

  &:hover {
    background-color: lighten($button-color, 5%);
    @extend .z-depth-1-half;
  }
}

.btn-large {
  @extend .btn;
  height: $button-height * 1.5;
  line-height: 56px;

  i {
    font-size: $button-large-icon-font-size;
  }
}

Commenting out @extend .btn lets everything compile, and all is fine.

irundaia commented 8 years ago

Were you using "org.webjars.bower" % "materialize" % "0.97.5"? If so, I'll have a look once I get home. Which OS you're using?

thepratt commented 8 years ago

Yes, it was the bower version.

irundaia commented 8 years ago

Okay, I've had a quick look. This bug seems to have been introduced with the upgrade to libsass 3.3.3. A quick workaround would be to use sbt-sassify version 1.4.1. I've tested it there, and it seems to work in this version.

irundaia commented 8 years ago

I've tried to compile using sassc with libsass 3.3.3. This also fails with a segmentation fault. I've been trying to generate a minimal example exhibiting this behaviour, but I as soon as I've condensed it to a small example, libsass will compile it, so I'm unsure how I should report this issue to the libsass team. :(

thepratt commented 8 years ago

Sorry, didn't see the second part of your question on my phone. I'm using Ubuntu 15.04.

Here is a base case that I found (using the stuff from materialize to help narrow down) that fails when using 1.4.2:

.yellow {
  color: white;
  background-color: yellow;
}

.z-depth-1 {
  box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12);
}

.z-depth-half-1 {
  box-shadow: 0 5px 11px 0 rgba(0, 0, 0, 0.18), 0 4px 15px 0 rgba(0, 0, 0, 0.15);
}

.btn {
  text-decoration:none;
  text-align: center;
  @extend .z-depth-1;

  &:hover {
    @extend .z-depth-1-half;
  }
}

.btn--yellow {
  @extend .yellow;
  @extend .btn;
}

Everything succeeds when I remove &:hover.

irundaia commented 8 years ago

I added the second part to my question later, it's likely that's why you missed it. I just wanted to make sure that I could reproduce the error.

In any case, this seems to be a different issue. In your example you use @extend .z-depth-1-half; while the selector is defined as .z-depth-half-1. This should not cause a segfault so I've reported this issue with libsass.

If this issue is fixed, I'm not convinced materialize will compile though.

irundaia commented 8 years ago

The bug causing the example to crash has been fixed. However, materialize still causes libsass to crash. I'll try to determine the cause tomorrow again.

CapeSepias commented 8 years ago

any progress? love your plugin.

irundaia commented 8 years ago

Thanks for the love, I appreciate it.

I've filed an issue with libsass. They'll fix the segfault in the next release (most likely). Unfortunately, this will result in incorrect CSS. The issue has been scheduled to be fixed in the release afterwards (planned for June 20th).

irundaia commented 8 years ago

I've just released sbt-sassify v1.4.6. With the new version of libsass, the compile issues with materializecss seems to have been fixed. Closing this issue.