`@scope` support
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Anfängerfreundlichkeit
- 25/100
Rechercherichtung
Das Issue nennt kein Plugin, keine Datei und keinen Test-Einstiegspunkt. Beginne damit, die Plugin-Struktur des Repositorys und die bestehende Verarbeitung von CSS-At-Regeln zu untersuchen, und lies anschließend die verlinkte CSS-Cascade-6-Spezifikation und Browser-Referenzen. Erledigt wäre die Aufgabe, wenn ein abgestimmtes Implementierungsdesign für @scope, Kompatibilitätsgrenzen und Tests vorliegt, die das vorgeschlagene Verhalten abdecken.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
What would you want to propose?
I'd like to suggest support for @scope
- https://drafts.csswg.org/css-cascade-6/#scoped-styles
- https://developer.mozilla.org/en-US/docs/Web/CSS/@scope
- https://developer.chrome.com/docs/css-ui/at-scope
Suggested solution
This is just an idea, I have no idea if this would work in general.
https://jsfiddle.net/mindplay/agd9k2p1/
So this:
@scope (.panel) to (.content) {
h2 {
color: red;
}
}
Becomes this:
:where(.panel) h2:where(:not(.content h2)) {
color: red;
}
And a more complex selector like this:
@scope ([scope=panel]) to ([scope]:not([scope=panel])) {
h2 {
color: red;
}
p {
font-weight: bold;
}
}
Becomes this:
:where([scope=panel]) h2:where(:not([scope]:not([scope=panel]) h2)) {
color: red;
}
:where([scope=panel]) p:where(:not([scope]:not([scope=panel]) p)) {
font-weight: bold;
}
So this would require both :where and :not, I think - to get the right specificity.
But this is just a rough idea - I'm not a CSS superhero, and I don't know if this is completely correct or scoped properly etc.
Additional context
Only a few browsers support this already.
https://caniuse.com/css-cascade-scope
But this would be an incredible feature, if we didn't have to wait 3-5 years for every browser to support it - we could basically stop using CSS frameworks, CSS-in-JS, Tailwind etc. would all essentially be obsolete (from my personal point of view!) and we could finally have something resembling component-scoped CSS natively in the browser without JavaScript. 😄
Validations
- Follow our Code of Conduct
- Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
Would you like to open a PR for this feature?
- I'm willing to open a PR
- Vorherrschende Sprache
- CSS
- Sterne
- 1.1k
- Forks
- 83
- Ø Merge
- 6 Std. 43 Min.
- Gemergte PRs (30 T.)
- 26
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus csstools/postcss-plugins
-
`symbols()` functionOffenfeature request
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 52/100
csstools/postcss-plugins#1894 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 35/100
csstools/postcss-plugins#1717 ·
Maintainer antworten meist innerhalb von 1 Tag
-
feature request
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 25/100
csstools/postcss-plugins#1667 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug plugins/postcss-font-variant upstream
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 45/100
csstools/postcss-plugins#1546 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
help wanted
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 35/100
csstools/postcss-plugins#1451 · 1 Kommentar · 2 Reaktionen ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in csstools/postcss-plugins
Ähnliche Issues
-
good first issue hacktoberfest
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
Tanishq964/trail-kit.#4 ·
-
Optional url field cannot be cleared in the admin: empty value rejected as invalid URLEvtl. vergeben @emdashbot hat das heute übernommen. Offenbot:bug bot:needs-attention
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
emdash-cms/emdash#4075 · 3 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
enhancement good first issue ready-for-agent
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 92/100
AbhishekBalija/MathGPT#56 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
no-human-ai/no_human#660 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100