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 doesn't work when there are multiple rules per font #950

Closed
clarfonthey opened this issue Jun 11, 2017 · 4 comments
Closed
Labels
Milestone

Comments

@clarfonthey
Copy link

Minimal example:

@font-face {
    font-family: font;
    font-weight: regular;
}
@font-face {
    font-family: font;
    font-weight: bold;
}

This will minify to:

@font-face{font-family:font;font-weight:regular}

Which is wrong.

@clarfonthey
Copy link
Author

It appears to be an error in this function: https://github.com/jakubpawlowicz/clean-css/blob/f273443f3d697764777e4618121d780c6894a922/lib/optimizer/level-2/remove-unused-at-rules.js#L112

The check for used font-family rules doesn't check if the block is itself a @font-face block.

@jakubpawlowicz
Copy link
Collaborator

👍 it should be checked that way indeed, thanks for digging for the solution

@jakubpawlowicz jakubpawlowicz added this to the 4.1.4 milestone Jun 13, 2017
jakubpawlowicz added a commit that referenced this issue Jun 13, 2017
Why:

* A `@font-face` with particular font-family can be declared more than
  once, e.g. when referring different font weights.
@jakubpawlowicz
Copy link
Collaborator

Fixed in 4.1.4!

@clarfonthey
Copy link
Author

Thank you!

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