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

Can use extend-postcss alias as extend rule #35

Closed Bartmr closed 5 years ago

Bartmr commented 6 years ago

@travco @jonathantneal @davidtheclark

Problem:

Some of us still use SASS from legacy code bases that force us to compile SCSS first. Using something like this:

@add-mixin somethingThatGeneratesClasses;

.my-class {
 @extend .generatedClass;
}

will make the SASS compiler grab that extend rule before PostCSS.

Solution:

Allow use of an alias for the @extend rule, in this case, @extend-postcss.

As reference, postcss-mixins does it, as described in the README section Migration from SASS.

sandrina-p commented 6 years ago

@davidtheclark and @travco can you review this PR? Thank you 😊

davidtheclark commented 6 years ago

@Bartmr @sandrina-p I'm not the owner or maintainer of this repo. If @travco is no longer maintaining the project, I suggest you fork it and carry out your intentions (though 9 days isn't very much time to wait for a response to a PR).

jonathantneal commented 6 years ago

I saw your note in the Gitter room, so I’ve added this functionality to postcss-extend-rule, if that helps you.

import postcssExtend from 'postcss-extend-rule';

postcssExtend({ name: 'postcss-extend' })
jonathantneal commented 5 years ago

@Bartmr, @davidtheclark, we can probably close out this PR.

Bartmr commented 5 years ago

@jonathantneal @davidtheclark yes. There wasn't even a clear direction when I opened this in my older company.