travco / postcss-extend

A PostCSS plugin to minimize the number of repeat-selectors and rules you write
MIT License
114 stars 8 forks source link

Extending a class doesn't work? #20

Closed ericdfields closed 8 years ago

ericdfields commented 8 years ago

This works for me:

@define-placeholder dark-blue-background {
  background-color: #004a6b;
  color: white;
  box-shadow: rgba(255, 255, 255, 0.11) 0 -30px 60px inset;
}

.person__header {
  @extend dark-blue-background;
  padding: 20px 0 1em;
  height: 12vh;
}

This doesn't work, but I'd expect it should based on the docs:

.dark-blue-background {
  background-color: #004a6b;
  color: white;
  box-shadow: rgba(255, 255, 255, 0.11) 0 -30px 60px inset;
}

.person__header {
  @extend .dark-blue-background;
  padding: 20px 0 1em;
  height: 12vh;
}

Error: `.dark-blue-background, has not (yet) been defined, so cannot be extended`

Am I wrong in thinking that the latter should work?

travco commented 8 years ago

Fixed as part of 3dc789b, turns out there was some slippage in the recusion handler. Mostly my fault for not getting that fix out to the NPM repo.

I'm going to close the issue, but if it persists on your machine feel free to reopen and please reply.