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

[carbon-web-components/web components]: Remove global CSS out of component stylesheets #10557

Closed
4 tasks
kennylam opened this issue Jun 13, 2023 · 1 comment
Closed
4 tasks
Assignees
Labels
dev Needs some dev work owner: Innovation Team used when the engineering work will be done by Hybrid Cloud with DDS engineers as consultants package: carbon web components package: web components Work necessary for the IBM.com Library web components package v2

Comments

@kennylam
Copy link
Member

kennylam commented Jun 13, 2023

All web components currently bring global styles into their component style sheets. This has two major drawbacks:

  • All component definitions include those styles, bloating each component's filesize with duplicated code
  • All component instances create & contain their own copy of the global styles, bloating the overall memory footprint of the UI

Additionally, some components are using the scss @extend function to re-purpose styles for updated markup. This, however, does not remove the unnecessary style declarations for older markup.

To correct this, we need to remove global styles (and perhaps style primitives like button, link, etc) and reduce the existence of "dead" css in all component stylesheets. Doing this should help a few key metrics, including load time, total blocking time, and memory usage.

A demo of many components sharing a single CSSStyleSheet via adoptStyles. can be found here

Tasks

Preview Give feedback
@kennylam kennylam added dev Needs some dev work package: web components Work necessary for the IBM.com Library web components package package: carbon web components v2 labels Jun 13, 2023
@kennylam kennylam moved this to Backlog in Carbon for IBM.com Jun 13, 2023
@ariellalgilmore ariellalgilmore self-assigned this Jun 27, 2023
@andy-blum
Copy link
Member

Anecdotally, this should be a huge boost for AEM. A quick hack-and-slash removing all CSS from our bundled web components takes the unminified version of the file down from 12.4mb to 2.8mb

@oliviaflory oliviaflory moved this from Backlog to Doing in Carbon for IBM.com Jul 24, 2023
@oliviaflory oliviaflory moved this from Doing to Backlog in Carbon for IBM.com Jul 24, 2023
@andy-blum andy-blum changed the title [Carbon web components]: update component CDN to use global styles [carbon-web-components/web components]: Remove global CSS out of component stylesheets Jul 31, 2023
@andy-blum andy-blum added the owner: Innovation Team used when the engineering work will be done by Hybrid Cloud with DDS engineers as consultants label Jul 31, 2023
@andy-blum andy-blum closed this as not planned Won't fix, can't repro, duplicate, stale Dec 11, 2024
@github-project-automation github-project-automation bot moved this from Backlog to Done in Carbon for IBM.com Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dev Needs some dev work owner: Innovation Team used when the engineering work will be done by Hybrid Cloud with DDS engineers as consultants package: carbon web components package: web components Work necessary for the IBM.com Library web components package v2
Projects
Status: Done
Development

No branches or pull requests

3 participants