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

removeUnusedAtRules removes @font-face for fonts used in CSS variable declarations #1229

Open
alecglassford opened this issue Aug 4, 2022 · 0 comments

Comments

@alecglassford
Copy link

alecglassford commented Aug 4, 2022

Environment

  • clean-css version - 5.3.1
  • node.js version: 16.16.0
  • operating system: N/A

Configuration options

new CleanCSS({ level: { 2: { removeUnusedAtRules: true } } })

Input CSS

@font-face {
    font-family: test;
    src: url(https://test);
}

:root {
    --serif-stack: test;
}

p {
    font-family: var(--serif-stack);
}

Actual output CSS

:root{--serif-stack:test}p{font-family:var(--serif-stack)}

Expected output CSS

@font-face{font-family:test;src:url(https://test)}:root{--serif-stack:test}p{font-family:var(--serif-stack)}

In this example, it seems that because the test font is only used in a CSS variable declaration, clean-css mistakenly considers it "unused."

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

No branches or pull requests

1 participant