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

Since 3.32.2 a single :host style selector is removed when producing web components #5982

Closed
rd-stefan-riehmer opened this issue Feb 10, 2021 · 2 comments · Fixed by #5984
Closed

Comments

@rd-stefan-riehmer
Copy link

rd-stefan-riehmer commented Feb 10, 2021

Is there a reason why, but the :host style selector is removed when compiling this. Works in svelte 3.32.1, but not in 3.32.2.

<style>
    :host {
        display: inline-block;
    }
    .hello {
        color: green
    }
</style>

Result:
only the .hello class is available in the compiled web component.

@rd-stefan-riehmer rd-stefan-riehmer changed the title Since 2.32.2 a single :host style selector is removed when producing web components Since 2.32.3 a single :host style selector is removed when producing web components Feb 10, 2021
@rd-stefan-riehmer rd-stefan-riehmer changed the title Since 2.32.3 a single :host style selector is removed when producing web components Since 3.32.2 a single :host style selector is removed when producing web components Feb 10, 2021
@tanhauhau tanhauhau mentioned this issue Feb 11, 2021
3 tasks
@rd-stefan-riehmer
Copy link
Author

rd-stefan-riehmer commented Feb 11, 2021

watching the logs it says:

(!) Plugin svelte: Unused CSS selector ":host"
src/App.svelte
108: 
109: <style>
110:     :host {
         ^
111:         display: inline-block;
112:     }

why is it "unused"? i am using it. the :host selector allows gettings things right at the components very root (the custom element itself). is there any workaround to get this going again?

https://developer.mozilla.org/en-US/docs/Web/CSS/:host <- example on styling the shadow host.

@Conduitry
Copy link
Member

Thanks for the report! This should be fixed in 3.32.3.

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