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

Placeholder classes don't separate with "," comma ! #31

Open amerllica opened 7 years ago

amerllica commented 7 years ago

When I write:

%align-row, %align-ver {
   display: flex;
   flex-direction: row;
}

The exported CSS is wrong, In exported CSS file I see all classes with placeholder properties and the placeholder classes in CSS file which is a big mistake, but when I write:

%align-row {
   display: flex;
   flex-direction: row;
}

%align-ver {
   display: flex;
   flex-direction: row;
}

The exported file has true syntax.

travco commented 7 years ago

Because placeholder classes are supposed to be a single identifier that is either used (and replaced) or discarded it wasn't coded considering multiple placeholders (which is basically aliasing) in the same declaration.

I think of only one case where having multiple silent placeholders declaring the exact same things would be helpful (aliasing) - but it certainly wasn't the intended use when I wrote it. I should be able to nab this with the long-waiting PR sometime this week.

In the meantime if you want this kind of functionality, you should be able to extend into whichever one you want to be the parent:

%align-row {
   display: flex;
   flex-direction: row;
}

%align-ver {
   /* Some other css declarations*/
  @extend %align-row;
}