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]: A :hover in a nested rule is reported as useless #1153

Open
1 task done
regseb opened this issue Sep 4, 2023 · 0 comments
Open
1 task done

[Bug]: A :hover in a nested rule is reported as useless #1153

regseb opened this issue Sep 4, 2023 · 0 comments
Labels

Comments

@regseb
Copy link

regseb commented Sep 4, 2023

Describe the bug

A :hover in a nested rule is reported as useless.

To Reproduce

  • package.json

    {
      "name": "testcase",
      "version": "1.0.0",
      "type": "module",
      "dependencies": {
        "purgecss": "5.0.0"
      }
    }
  • index.html

    <!doctype html>
    <html>
      <head>
        <meta charset="utf-8" />
        <title>Test case</title>
        <link href="style.css" rel="stylesheet" />
      </head>
      <body>
        <a href="https://github.com/">GitHub</a>
      </body>
    </html>
  • style.css

    a:hover {
      background-color: green;
    }
    
    a {
      &:hover {
        color: red;
      }
    }
  1. npm install
  2. npx purgecss --css style.css --content index.html --rejected
[{
  "css": "a:hover {\n    background-color: green;\n}\n",
  "file": "style.css",
  "rejected": ["&:hover"]
}]

Expected Behavior

[{
  "css": "a:hover {\n    background-color: green;\n}\n\na {\n    &:hover {\n        color: red;\n    }\n}\n",
  "file": "style.css",
  "rejected": []
}]

Environment

  • Ubuntu: 22.04.3 LTS
  • Node.js: v18.17.1
  • npm: 9.8.1
  • purgecss: 5.0.0

Add any other context about the problem here

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@regseb regseb added the bug label Sep 4, 2023
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

1 participant