Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
do not emit empty at-rules
There are some exceptions to this rule. Some at-rules can be body-less:
```css
@charset "UTF-8";
@layer foo, bar, baz;
@Custom-Media --modern (color), (hover);
```
  • Loading branch information
RobinMalfait committed Jan 31, 2025
commit 3d8db39d55a700d2def727db3fca905fd14dcdc6
9 changes: 8 additions & 1 deletion packages/tailwindcss/src/ast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,14 @@ export function optimizeAst(ast: AstNode[]) {
for (let child of node.nodes) {
transform(child, copy.nodes, depth + 1)
}
parent.push(copy)
if (
copy.nodes.length > 0 ||
copy.name === '@layer' ||
copy.name === '@charset' ||
copy.name === '@custom-media'
) {
parent.push(copy)
}
}

// AtRoot
Expand Down