Skip to content

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
@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.

3 participants