Closed oskar-anderson closed 5 months ago
Thanks @oskar-anderson for the detailed feature request. Seems like a reasonable use case to support. I will take a look and let you know how I go.
@oskar-anderson if you see the PR https://github.com/dbtedman/postcss-prefixwrap/pull/361, with a source of
.something {
font-size: 40px;
}
.something p {
color: red;
}
Is the following prefix behaviour what you were expecting to see?
my-container .something, .my-container.something {
font-size: 40px;
}
.my-container .something p, .my-container.something p {
color: red;
}
If so, I will get this feature released so it is available for you and others to use.
This looks great!
Request
Add option
appendCompoundSelector
that generates 2 selectors:PREFIX .container, PREFIX.container
. This will allow the style rules to start applying from the prefix level, removing the need to have extra divs.Basically:
Use case
I have 3 levels of styles:
The apps need to use a css prefix to overwrite site styles, but unfortunately the component library also needs a css prefix, otherwise import will fail
This causes cascade problems between Tailwind utility classes and generic styles when dealing with slotted content (EX ".eof .eac menu" > ".eof .mx-9"). Using
.eac *:not(.ssc)
prefix stops the styles from cascading (ssc - stop style cascade):But it requires an extra div before the styles start applying, making the html structure cumbersome: