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

feat: inject template styles to shadow dom #58

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

loberbichler
Copy link

@loberbichler loberbichler commented Feb 25, 2021

What does this PR do

The goal of this PR is to allow the use of shadow dom and still be able to style elements and children via "normal" classnames.

Also installs libharfbuzz-icu0 libenchant1c2a to the host system as the ubuntu lts changed from 18.04 to 20.04.

Why is this PR needed

As web components with shadow dom are isolated, global styles do not apply, the styles need to be available inside the components shadow dom.
This PR adds the possibility to pass styles to the options object of the register method. If given styles, the method appends a <template> element (if it does not exist already) with the given styles to the <head> and appends a copy to the components _root.

Example

I've created an example to showcase the feature CodeSandbox preact-custom-element style-injection

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 this pull request may close these issues.

1 participant