csstools / postcss-extend-rule

Use the @extend at-rule and functional selectors in CSS
https://jonathantneal.github.io/postcss-extend-rule/
Creative Commons Zero v1.0 Universal
51 stars 7 forks source link

Support for !important @extend #12

Closed minimit closed 8 months ago

minimit commented 4 years ago

Is it possible to support !important in extend compiled? I know the @extend specifications don't specify it..

.btn {
  @extend .btn-setup !important;
}

.btn-setup {
  background: red;
}

Result

.btn {
  background: red !important;
}

.btn-setup {
  background: red;
}
minimit commented 4 years ago

@jonathantneal Thanks for your work , i've seen you need to do a rewrite of the plugin. any info? I've read the discussion about @apply in css drafts and right now I can't find any really good postcss mixins (I like the less mixins they work pretty much like this plugin).

romainmenke commented 8 months ago

hi @minimit,

This is beyond the scope of this plugin and against the core concept.

@extend as a feature is purely : "act as if element with class .foo also matches class .bar".

Modifying the declarations by making them important goes against the fundamentals of the feature.