patternfly / patternfly/patternfly-react

Revamp react-tokens logic

Open
#10,212 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

PF Team Spike Stale
Dominant language
TypeScript
Stars
862
Forks
392
Avg merge
4d 8h
Merged PRs (30d)
9

Description

Describe the enhancement or change
Our token generation in the react-tokens package needs to be reworked as the logic we use to determine css var values doesn't match 1:1 with how that value will be determined in browser, this can lead to build breaking bugs with recursively defined values.

We've implemented a temporary fix for this, but it is still not optimal as differences in behavior could occur if a var is defined multiple times in a stylesheet. Ideally we should only parse the css within the root selector of the stylesheet.

Additionally, core currently has to add some variables to the root scope for the sole purpose of having the token created in react-tokens, ideally this will not be required in the future.


Jira Issue: PF-92

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the react-tokens package and its temporary token-generation fix, then inspect how core adds variables to the root scope. Compare the package's CSS variable resolution with browser behavior, especially recursively defined or multiply defined variables. Done means root-scope parsing matches browser resolution and core no longer needs extra variables solely to create tokens.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
build-system, frontend
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.