-
Notifications
You must be signed in to change notification settings - Fork 183
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(scss): Optimized SCSS to remove need to separately load @carbon/styles #1652
feat(scss): Optimized SCSS to remove need to separately load @carbon/styles #1652
Conversation
… optimize use of globals
…o be individually loaded
✅ Deploy Preview for carbon-charts-core ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for carbon-charts-react ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for carbon-charts-angular ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed with latest push. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Problems this solves...
@carbon/charts
and the packages for React, Angular, Svelte, and Vue required that@carbon/styles/css/styles.css
be loaded IN ADDITION TO the styles for the chart component libraries. This caused the entire stylesheet for@carbon/styles
to be loaded including styles for components not used by@carbon/charts
increasing download times. It also added extra work to implement@carbon/charts
(more moving parts and more documentation).@carbon/styles/css/styles.css
also applies a CSS reset which messes up Bootstrap and Material Design's CSS reset. That forces developers who do not want body-level@carbon/styles
styling to use the shadow DOM for components.@carbon/styles
was only needed for the toolbar and its modal (tabular representation). These are overflow-menu, button, modal, and data-table modules in@carbon/styles
that should have been loaded by their corresponding Carbon Charts SCSS components.@carbon/charts
SCSS used@import
which is deprecated@carbon/import-once
was used as a workaround because@import
was used instead of@use
for network diagram components.@use 'something' as *;
which makes it difficult to understand where variables originate.@use
by other modules.@carbon/styles
andsass
(latter to avoid an install prompt by StackBlitz).@carbon/charts-angular
exports specified the dist folder for styles.css and styles.min.css but because the dist folder is what's published (rather than the parent), these paths were wrong.How to test this
Because StackBlitz normally loads styles.css from the latest version of
@carbon/charts
, please use this StackBlitz example. The file packages/core/dist/styles.css has been copied and pasted into a file in the example then loaded. Please note that the Zoom button is always hidden in StackBlitz examples (not specific to this PR).