-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Do not emit empty rules/at-rules #16121
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
Changes from all commits
d73a187
3d8db39
e635954
356d0c5
268487d
2396d9c
f7f38a8
92c2d1c
8e6fe3b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -261,7 +261,9 @@ export function optimizeAst(ast: AstNode[]) { | |
for (let child of node.nodes) { | ||
let nodes: AstNode[] = [] | ||
transform(child, nodes, depth + 1) | ||
parent.push(...nodes) | ||
if (nodes.length > 0) { | ||
parent.push(...nodes) | ||
} | ||
} | ||
} | ||
|
||
|
@@ -271,7 +273,9 @@ 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) { | ||
parent.push(copy) | ||
} | ||
} | ||
} | ||
|
||
|
@@ -297,7 +301,15 @@ 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' || | ||
copy.name === '@namespace' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @media (foo) {} Should be removed imo There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah i noticed this too, you just responded before i could update my comment heh There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hehe, I think in theory we could invert the condition and don't touch everything but the In a perfect world |
||
) { | ||
parent.push(copy) | ||
} | ||
} | ||
|
||
// AtRoot | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3167,8 +3167,6 @@ describe('addUtilities()', () => { | |
color: red; | ||
} | ||
} | ||
} | ||
:root, :host { | ||
}" | ||
`, | ||
) | ||
|
Uh oh!
There was an error while loading. Please reload this page.