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

:global() still gets component class added when ">" is not inside the :global() #253

Closed
FreekyMage opened this issue Sep 16, 2020 · 4 comments
Assignees
Labels
question Further information is requested

Comments

@FreekyMage
Copy link

I posted this in the svelte repo first, because I think the fault is theirs, but I can't reproduce the error with pure svelte. The info below is what I posted there

Describe the bug
When a > is behind a :global() and thus outside the parentheses, the globalised class still gets the class of the component.
I think it's a conflict between svelte and svelte-preprocess that got started with sveltejs/svelte#4795 (we didn't have this issue yesterday)

To Reproduce
I couldn't reproduce the issue with https://svelte.dev/repl because I think it's a conflict between svelte and svelte-preprocess.

So in our project we have something like this:

:global(.menu) > .menu-item {...}

The result is the same with the normal style tag or one with lang="scss".
This outputs to:

.svelte-100eekq.menu > .menu-item.svelte-100eekq {...}

The adjustment below does produce the expected output, but shouldn't be required I think:

:global(.menu >) .menu-item {...}

If this is ok for the svelte team, then this might need to be warned about in the documentation.

Expected output

.menu > .menu-item.svelte-100eekq {...}

Information about your Svelte project:

  • node-sass: 4.14.1
  • sass-loader: 8.0.2
  • svelte 3.25.1
  • svelte-preprocess: 3.9.12 (and 4.3.0 tested with same results)
  • webpack 4.44.1

Severity
Blocking upgrade

@floratmin
Copy link

I have the same problem, but in a different context. When I add autoprefixer in svelte-preprocess, then I get :global() injected into my style imported from sass. I just created a repo for this:
https://github.com/floratmin/sapper-bulma-scss-treeshaking

@kaisermann
Copy link
Member

kaisermann commented Sep 25, 2020

Hey, @FreekyMage 👋 Would you be able to provide a minimal reproducible example? I'm unable to reproduce the issue on a test case:

code

For now, seems to be an issue in the compiler.

@floratmin Would you be able to provide a minimal repro? A sapper project with a lot of CSS makes it difficult to identify the issue! 😁

@kaisermann kaisermann self-assigned this Sep 25, 2020
@kaisermann kaisermann added the question Further information is requested label Sep 25, 2020
@floratmin
Copy link

@kaisermann Here is the minimal repro with svelte.
https://github.com/floratmin/svelte-autoprefixer-example

@kaisermann
Copy link
Member

@floratmin Thanks for the repro I was able to pinpoint where the problem originated! Fixed in 4.4.2. However, the OP issue still seems to be related to the compiler.

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

No branches or pull requests

3 participants