Skip to content

Conversation

@thecrypticace
Copy link
Contributor

@thecrypticace thecrypticace commented Sep 29, 2025

Fixes #18678

When given a simple plugin like this:

export default {
  content: [{ raw: '!a' },],
  plugins: [
    ({ addBase }) => addBase({
      '@media (min-width: 1728px)': {
        '.a': { 'padding-top': '1rem !important' },
        '.b': { 'padding-right': '1rem !important' },
      }
    }),
  ],
}

If this plugin saw the utility !a it would correctly modify both rules to eliminate any irrelevant classes. Unfortunately, in the case of the 2nd rule this meant it's left with an empty selector which is invalid.

We now detect this case and remove the rule if that happens.

@thecrypticace thecrypticace requested a review from a team as a code owner September 29, 2025 20:05
@thecrypticace thecrypticace changed the title Remove irrelevant utility rules when matching important classes Sep 29, 2025
Copy link
Member

@RobinMalfait RobinMalfait left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, yep this would be bad:

Image
@thecrypticace thecrypticace merged commit aecc852 into v3 Sep 29, 2025
28 checks passed
@thecrypticace thecrypticace deleted the fix/issue-18678 branch September 29, 2025 22:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants