Skip to content
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

perf(preset-mini): apply preflight vars to :root #1205

Merged
merged 2 commits into from Jul 1, 2022
Merged

Conversation

antfu
Copy link
Member

@antfu antfu commented Jul 1, 2022

I don't know why we aren't doing it from the beginning 🤣

/cc @chu121su12 in case you are aware of any caveat of this approach.

@netlify
Copy link

netlify bot commented Jul 1, 2022

Deploy Preview for unocss canceled.

Name Link
🔨 Latest commit 1866639
🔍 Latest deploy log https://app.netlify.com/sites/unocss/deploys/62bf1ce7b545a80009e14a52

@antfu antfu merged commit fa384ba into main Jul 1, 2022
@antfu antfu deleted the perf/preflight-root branch July 1, 2022 16:24
@sibbng
Copy link
Member

sibbng commented Jul 2, 2022

This change turns per element variables into some kind of global variables. As a result, nested elements will have unwanted styles. For example:

<div class="p-10 bg-black text-white">
  <div class="ring-8 ring-offset-8 p-4">
    should have offset
    <div class="ring transform">shouldnt have offset</div>
  </div>
</div>

UnoCSS Playground - Tailwind Playground

Expected (Tailwind Playground): Nested div shouldn't have ring offset
image

Actual (UnoCSS): Nested div have ring offset
image

This issue will appear for all CSS variables that are used in the output but do not have a redefinition, such as ring-color, ring offset color, shadow utilities etc.

@antfu
Copy link
Member Author

antfu commented Jul 2, 2022

Oh I see. Thanks for the explanation and I will revert it

antfu added a commit that referenced this pull request Jul 2, 2022
MellowCo added a commit to MellowCo/unocss-preset-weapp that referenced this pull request Jul 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants