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: hydrate - Remove scoped css classes if serializeShadowRoot is true. #5880

Closed
3 tasks done
mayerraphael opened this issue Jul 3, 2024 · 1 comment · Fixed by #5892 · May be fixed by AnirudhJalagam/ionic-frameworkss#2
Closed
3 tasks done
Assignees
Labels
Bug: Validated This PR or Issue is verified to be a bug within Stencil

Comments

@mayerraphael
Copy link

mayerraphael commented Jul 3, 2024

Prerequisites

Describe the Feature Request

Currently Stencil scopes the CSS inside the Declarative Shadow DOM, which is not necessary anymore, as they are already isolated.

The bigger problem is that this bloats the size of the HTML massively.

Describe the Use Case

A simple css class like

.left-0 {left:var(--spacing-0)}

is bloated to

/*!@.left-0*/.left-0.sc-my-maybe-long-component-name{left:var(--spacing-0)}

This round about triples the size of css classes.

Here another example:

/*!@.button.primary:focus-within.focus-wcag-none:not(:hover,:active,.suppressFocusStyle)*/
.button.primary.sc-my-maybe-long-component-name:focus-within.focus-wcag-none:not(:hover, .sc-my-maybe-long-component-name:active, .suppressFocusStyle).sc-my-maybe-long-component-name {
    outline: 2px solid var(--button-stroke-primary-focus)
}

Describe Preferred Solution

No additional classname CSS selector necessary. No CSS comments necessary.

Describe Alternatives

No response

Related Code

No response

Additional Information

No response

@ionitron-bot ionitron-bot bot added the triage label Jul 3, 2024
@christian-bromann christian-bromann self-assigned this Jul 3, 2024
@christian-bromann christian-bromann added Bug: Validated This PR or Issue is verified to be a bug within Stencil and removed triage labels Jul 3, 2024
@mayerraphael
Copy link
Author

Currently this also means that the ::slotted selectors are broken.

They are scoped to

/*!@.container ::slotted(img)*/
.container .sc-my-component-s>img {}

This selector only works with the old SSR where everything was in light DOM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug: Validated This PR or Issue is verified to be a bug within Stencil
Projects
None yet
2 participants