-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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: custom type property output proposal #17198
base: main
Are you sure you want to change the base?
feat: custom type property output proposal #17198
Conversation
✅ Deploy Preview for v11-carbon-react ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for carbon-elements 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.
What if they were emitted on :root
behind a new sass config variable? Similar set up to what was done for the layout tokens, #14336, it would live in @carbon/styles
but could put the @include
behind the config variable. That way they'd conditionally be emitted inline in @carbon/styles and could use the existing mixin helpers like declaration
.
@tay1orjones I can add a feature flag, but making use of With I'm not sure how to access
|
This was my attempt with a feature-flag. https://github.com/lee-chase/carbon/tree/instantiateTypeTokensWithFeatureFlags |
Sorry, I just spotted that you said it would live in Carbon styles. I'll adjust and update the PR. |
@tay1orjones now has a feature flag. |
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.
Nice! We could probably avoid the extra feature flag overhead by instead using just a sass config variable. A good example is $css-font-face
carbon/packages/styles/scss/_config.scss
Lines 15 to 19 in 539fc8f
/// If true, includes font face mixins from scss/fonts | |
/// @access public | |
/// @type Bool | |
/// @group config | |
$css--font-face: true !default; |
carbon/packages/styles/scss/fonts/_index.scss
Lines 43 to 54 in 36685a0
@if config.$css--font-face == true { | |
@if enabled(mono.$name) { | |
@include mono.default(); | |
} | |
@if enabled(sans-arabic.$name) { | |
@include sans-arabic.default(); | |
} | |
@if enabled(sans-devanagari.$name) { | |
@include sans-devanagari.default(); | |
} |
The config variables like this are the sort-of "default" convention for conditionally emitting styles where there isn't a js interaction that requires a js feature flag
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #17198 +/- ##
=======================================
Coverage 76.92% 76.92%
=======================================
Files 408 408
Lines 13979 13979
Branches 4339 4339
=======================================
Hits 10754 10754
Misses 3052 3052
Partials 173 173 ☔ View full report in Codecov by Sentry. |
Contributes to #17173
Adds the ability to output custom properties for type.
Changelog
New
Changed
Testing / Reviewing
Added a simple test.