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

@apply with @supports produces extra commas #6246

Closed
leevigraham opened this issue Dec 2, 2021 · 1 comment · Fixed by #6594
Closed

@apply with @supports produces extra commas #6246

leevigraham opened this issue Dec 2, 2021 · 1 comment · Fixed by #6594

Comments

@leevigraham
Copy link

leevigraham commented Dec 2, 2021

What version of Tailwind CSS are you using?

2.2.19

What build tool (or framework if it abstracts the build tool) are you using?

tailwind cli

What version of Node.js are you using?

v14.18.1

What browser are you using?

N/A

What operating system are you using?

macOS

Reproduction URL

https://github.com/leevigraham/tailwind-apply-bug-repro

Describe your issue

  • Issue: Output contains additional ,'s breaking css.
  • Desired output: No extra commas

I'll admit this is a bit of a weird one but I ran into it writing some funky css. This test case is the minimal repro (really minimal… no actual css attributes in rules).

The following css:

@tailwind components;

@layer components {

    .grid--cards {
    }

    .grid-X,
    .grid-Y,
    .grid-Z {
        @apply grid--cards;
    }

    @supports (grid-template-rows: subgrid) {
        .grid--cards {}
        .some-other-rule {}
    }
}

Produces:

.grid-X, .grid-Y, .grid-Z {
}

@supports (grid-template-rows: subgrid) {
  .grid-X, .grid-Y, .grid-Z {
  }

  , ,  {
  }
}

Reproduction:

  1. Clone the repo and run npm install.
  2. Run npx tailwindcss -i input.css -o output.css
  3. check output.css

Issue also exists in tailwind@next: npx tailwindcss@next -i input.css -o output.css

Notes:

Removing .some-other-rule {} results in:

.grid-X, .grid-Y, .grid-Z {
}

@supports (grid-template-rows: subgrid) {
  .grid-X, .grid-Y, .grid-Z {
  }
}

Adding more rules results in more commas:

/* input.css */
@tailwind components;

@layer components {

    .grid--cards {
    }

    .grid-X,
    .grid-Y,
    .grid-Z,
    .grid-Z,
    .grid-Z,
    .grid-Z {
        @apply grid--cards;
    }

    @supports (grid-template-rows: subgrid) {
        .grid--cards {}
        .some-other-rule {}
    }
}
/* output.css */
.grid-X, .grid-Y, .grid-Z, .grid-Z, .grid-Z, .grid-Z {
}

@supports (grid-template-rows: subgrid) {
  .grid-X, .grid-Y, .grid-Z, .grid-Z, .grid-Z, .grid-Z {
  }

  , , , , ,  {
  }
}
@RobinMalfait
Copy link
Member

Hey! Thank you for your bug report!
Much appreciated! 🙏

This will be fixed in the next version 👍

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

Successfully merging a pull request may close this issue.

2 participants