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

CSS codemod: do not wrap comment nodes in @layer #14517

Merged
merged 3 commits into from
Sep 25, 2024

Conversation

RobinMalfait
Copy link
Member

When CSS exists between two tailwind directives, then the CSS will be wrapped in an @layer to ensure it all ends up in the correct location in the final CSS file.

However, if the only thing between two tailwind directives is a comment, then the comment will also be wrapped in an @layer directive.

E.g.:

@tailwind base;
/* This is a comment */
@tailwind components;
/* This is another comment */
@tailwind utilities;

Results in:

@import "tailwindcss";
@layer base {
  /* This is a comment */
}
@layer components {
  /* This is another comment */
}

In this case, the layers don't matter, so this can be simplified to:

@import "tailwindcss";
/* This is a comment */
/* This is another comment */

Copy link
Member

@philipp-spiess philipp-spiess left a comment

Choose a reason for hiding this comment

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

Niceeee

@RobinMalfait RobinMalfait force-pushed the fix/css-codemod-do-not-wrap-comments branch from 7907540 to a1bc7e7 Compare September 25, 2024 12:49
@RobinMalfait RobinMalfait enabled auto-merge (squash) September 25, 2024 12:49
@RobinMalfait RobinMalfait merged commit ceae1db into next Sep 25, 2024
3 checks passed
@RobinMalfait RobinMalfait deleted the fix/css-codemod-do-not-wrap-comments branch September 25, 2024 12:58
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 this pull request may close these issues.

2 participants