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

Combine class names when imported from another file #38

Closed seleckis closed 5 years ago

seleckis commented 5 years ago

Seems classes are not combined when placeholders are imported from another file:

/* foo.pcss */
%foo {
  color: black;
}

/* bar.pcss */
@import "./foo.pcss";
.bar {
    @extend %foo;
}

/* baz.pcss */
@import "./foo.pcss";
.baz {
    @extend %foo;
}

posts-extend produces:

.bar {
  color: black;
}
.baz {
  color: black;
}

so it produces duplicated code. I use postcss-partial-import for imports.

Or this can be resolved in a different way?

seleckis commented 5 years ago

Closing this, as I have figured out that when files are imported then %foo placeholder is placed there twice. So seems it is an issue with imports