Skip to content

:global block produces invalid css for SelectorList #15816

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

Closed
paoloricciuti opened this issue Apr 22, 2025 · 1 comment · Fixed by #15817
Closed

:global block produces invalid css for SelectorList #15816

paoloricciuti opened this issue Apr 22, 2025 · 1 comment · Fixed by #15817
Assignees

Comments

@paoloricciuti
Copy link
Member

Describe the bug

Given a component like this

<style>
	:global {
		a, b {
			color: red;
		}
	}
</style>

the generated css looks like this

	/* :global {*/
		/* (unused) a, b*/ {
			color: red;
		}
	/*}*/

which is wrong because there's a block without a selector.

Reproduction

REPL

Logs

-

System Info

-

Severity

annoyance

@paoloricciuti
Copy link
Member Author

This is probably a regression from #15762 since now here

(!is_in_global_block(path) || node.children.length > 1) &&
!path.find((n) => n.type === 'ComplexSelector' && !n.metadata.used)

even if we are in a global block we still modify the code because node.children.length is greater than 1

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