Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Oct 24, 2025. It is now read-only.
This repository was archived by the owner on Oct 24, 2025. It is now read-only.

Feature request: handle bad @extends better #3081

@Ariane-B

Description

@Ariane-B

Long ago, Sass stopped taking compound @extends. It said an error message to the effect of "please use .selector-1, :pseudo-class". I didn't read the details, and I just obeyed. The code still worked, and I didn't bother to check, but that had the effect of producing monster selectors. For instance, extending ::before would extend every ::before in the code base.

It produced huge CSS files, but it worked. Recently, however, the result of my wrong @extend has just been... infinite compilation, a fast spinning fan, and the need to force-quit CodeKit.

I know my code is wrong, and I've refactored it in newer projects. But I wish these cases were handled better. An error message or something, instead of just infinitely looping on my extends. Because I'll need to fix older projects moving forward.

It would be nice if the compiler helped with error messages instead of just dying on me.

Would that be doable?

some-file.scss

.icon-arrow-right:before {
  content: "\e90a";
}

.some-random-element-with-before {
  &::before {
    content: '';
    // other styles
  }
}

.some-element {
  @extend .icon-arrow-right, :before;
}
// Repeat this sort of thing several times in the code base

Actual results

[Infinite compiling... CodeKit needs to be force-quit]

Expected result

[ERROR!] You probably @extended wrong, because
this is the 100th time we've extended "::before".
Compiling stopped at line X of file Y.

---OR---

[WARNING] Compiled successfully, but we produced the following gargantuan selector. Maybe fix your stuff?
Selector originates at line X of file Y.

version info:

codekit          3.11
node-sass        N/A     (Wrapper)       [JavaScript]  (I think CodeKit doesn't use this)
libsass          3.6.3   (Sass Compiler) [C/C++]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions