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

[Bug]: Variable in one css file used in another one removed #1262

Open
1 task done
fadomire opened this issue Jun 29, 2024 · 1 comment
Open
1 task done

[Bug]: Variable in one css file used in another one removed #1262

fadomire opened this issue Jun 29, 2024 · 1 comment
Labels

Comments

@fadomire
Copy link

fadomire commented Jun 29, 2024

Describe the bug

I have 2 css files that i pass to purgeCSS

  1. define CSS variables
    :root { --used-in-other-css-file: red; }
  2. define class that use those variables
    .button { color: var(--used-in-other-css-file) }

Depending on the order in the array of files i pass to purgeCss either my variable is removed or not.

If i pass variable file then class file, then variable is removed.
If i pass class file then variable file, my variable is preserved.

To Reproduce

Here is a git patch on this repo to reproduce the issue via tests
Changes-On-b8bb2a.patch

Expected Behavior

my variable is always preserved

Environment

6.0.0 purgecss
nodejs env

Code of Conduct

  • I agree to follow this project's Code of Conduct
@fadomire fadomire added the bug label Jun 29, 2024
@jeffijoe
Copy link

This is also the case when the variable is referenced in content, for example, a JavaScript file might read a variable's value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants