-
-
Notifications
You must be signed in to change notification settings - Fork 75
postcss-light-dark-function
generates bloat css in :root
#1454
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi @vovsemenv, Thank you for reaching out about this. Unfortunately there isn't much we can do about this. We test this extremely thoroughly and pass all the same tests that browsers do. The You can see this in action in this codepen: https://codepen.io/romainmenke/pen/wvLGwyb Notice how the output for Maybe it is too soon to use Fallbacks/polyfills can never be as performant and efficient as native implementations.
How do you mean? These are all very low specificity selectors and shouldn't conflict with anything you wrote yourself. Do you simply mean that there is a lot of generated CSS?
That seems like an issue with dev tools, not with Is there an actual problem when rendering pages? |
🤔 We can simplify one thing. We can output a single :root {
& * {
--csstools-light-dark-toggle--1: var(--csstools-color-scheme--dark) var(--gray-neutral-900);
--constant-bg-base-primary: var(--csstools-light-dark-toggle--1, var(--constant-bg-base-primary-night));
}
}
:root {
& * {
--csstools-light-dark-toggle--0: var(--csstools-color-scheme--dark) var(--system-blue-200);
--ad-other-focus: var(--csstools-light-dark-toggle--0, var(--system-blue-300));
}
} -> :root {
& * {
--csstools-light-dark-toggle--1: var(--csstools-color-scheme--dark) var(--gray-neutral-900);
--constant-bg-base-primary: var(--csstools-light-dark-toggle--1, var(--constant-bg-base-primary-night));
--csstools-light-dark-toggle--0: var(--csstools-color-scheme--dark) var(--system-blue-200);
--ad-other-focus: var(--csstools-light-dark-toggle--0, var(--system-blue-300));
}
} |
This is actually can help a lot too!! |
You can! 😄 The contributing guides are here : https://github.com/csstools/postcss-plugins/blob/main/CONTRIBUTING.md#quick-start The relevant code here is : postcss-plugins/plugins/postcss-light-dark-function/src/index.ts Lines 87 to 97 in 66f7bec
Keeping track of state and data can be done in the postcss-plugins/plugins/postcss-light-dark-function/src/index.ts Lines 15 to 18 in 66f7bec
I would likely use something like a Test config is here : https://github.com/csstools/postcss-plugins/blob/main/plugins/postcss-light-dark-function/test/_tape.mjs Maybe best to create a new test CSS file : And add an entry for it in 'common-patterns-1': {
message: 'support common patterns',
}, |
@romainmenke thank you very much for amazing work!!! |
What would you want to propose?
I try to use do this
but since i have 150+ colors
every light-dark produce new selector like this i end up in the selector hell. ( even chrome devTools stops working
Suggested solution
that lead to this result without additional selectors
Additional context
No response
Validations
Would you like to open a PR for this feature?
The text was updated successfully, but these errors were encountered: