Skip to content

createTextStyle: Correctly pass through debugId and remove redundant classname #227

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

Merged
merged 1 commit into from
May 29, 2025

Conversation

askoufis
Copy link
Contributor

@askoufis askoufis commented May 29, 2025

I noticed that one of the typography styles in Braid's Text component contained a classname without a debug ID:

reset_base__1vaeyfc0
sprinkles_display_block_mobile__z3xxmb4z
typography_fontFamily__wvf7we0
typography_fontWeight_regular__wvf7we1
typography_tone_neutral__wvf7we21
typography_textSizeTrimmed_standard__wvf7wec
typography__wvf7web <---------------------------- THIS ONE
capsize_capsizeStyle__1u941fx4
typography_textSize_standard__wvf7wea

I believe this is the composed classname from the outer style call in createTextStyle. It doesn't automatically get a debug ID because Vanilla Extract's automatic debug ID generation only runs on .css.* files, but createTextStyle is inside an index.mjs/cjs file, so it gets missed. I assume this is why debugId is propagated through createTextStyle, but it should've also been passed to the outer style call.

I've made 2 changes in this PR:

  1. Moved the debugId on the outer style call
  2. Removed the inner style call

Without removing the inner style call, the composed classname would've had a debug ID, but by removing it we actually end up generating 1 less classname, while maintaining all debug IDs, which I think is better overall.

Braid Text component classnames with this change:

reset_base__1vaeyfc0
sprinkles_display_block_mobile__z3xxmb4z
typography_fontFamily__wvf7we0
typography_fontWeight_regular__wvf7we1
typography_tone_neutral__wvf7we1t
typography_textSizeTrimmed_standard__wvf7we9
typography_textSize_standard__wvf7we8
capsize_capsizeStyle__1u941fx4

@askoufis askoufis requested a review from a team as a code owner May 29, 2025 00:06
Copy link

changeset-bot bot commented May 29, 2025

🦋 Changeset detected

Latest commit: 211d384

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@capsizecss/vanilla-extract Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@askoufis askoufis merged commit 2e83f03 into master May 29, 2025
6 checks passed
@askoufis askoufis deleted the fix-style-debugid branch May 29, 2025 00:43
@seek-oss-ci seek-oss-ci mentioned this pull request May 29, 2025
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.

2 participants