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

Styles start with :global() and contain ~ are removed #5499

Closed
btamas opened this issue Oct 5, 2020 · 8 comments · Fixed by #5957
Closed

Styles start with :global() and contain ~ are removed #5499

btamas opened this issue Oct 5, 2020 · 8 comments · Fixed by #5957
Assignees
Labels

Comments

@btamas
Copy link

btamas commented Oct 5, 2020

Describe the bug
When a style start with :global() and contain ~, it is detected as unused css and it won't be in the compiled component.

To Reproduce
https://svelte.dev/repl/f912b3cecd29433990eca1947b902184?version=3.29.0

Severity
Medium

@btamas btamas changed the title Styles start with :global() are removed Styles start with :global() and contains ~ are removed Oct 5, 2020
@btamas btamas changed the title Styles start with :global() and contains ~ are removed Styles start with :global() and contain ~ are removed Oct 5, 2020
@Conduitry
Copy link
Member

Interesting. @tanhauhau do you think it's practical to let the + and ~ combinators match as siblings to :global()s?

@btamas
Copy link
Author

btamas commented Oct 6, 2020

I debugged it more deeply and it came with version 3.27.0 and with https://github.com/sveltejs/svelte/pull/5427/files#diff-ad7d8aa7ba8f1612a46a38b563c075aaR211
I can downgrade svelte to 3.26.0, but I would really appreciate if you give an exception for globals.

1 similar comment
@btamas
Copy link
Author

btamas commented Oct 6, 2020

I debugged it more deeply and it came with version 3.27.0 and with https://github.com/sveltejs/svelte/pull/5427/files#diff-ad7d8aa7ba8f1612a46a38b563c075aaR211
I can downgrade svelte to 3.26.0, but I would really appreciate if you give an exception for globals.

@btamas btamas closed this as completed Oct 6, 2020
@btamas btamas reopened this Oct 6, 2020
@tanhauhau tanhauhau self-assigned this Oct 6, 2020
@tanhauhau
Copy link
Member

It's a bug. Will look into it.

Found that the scoping for :global(.abc) > .def wasn't working fine too

@non25
Copy link

non25 commented Nov 2, 2020

@tanhauhau any progress? Had to rollback to 3.26 :(

@non25
Copy link

non25 commented Nov 23, 2020

@Conduitry @Rich-Harris @antony
Can somebody rollback that PR until it is fixed or add exceptions for globals please?
Can't upgrade to ^3.27.0 because it will break components in several projects. 😞

@non25
Copy link

non25 commented Nov 25, 2020

@btamas Until fixed, you can workaround it like this:

:global(* +) .class

Thanks to https://github.com/lega911

@Conduitry
Copy link
Member

This should be fixed in 3.32.2 - https://svelte.dev/repl/f912b3cecd29433990eca1947b902184?version=3.32.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants