8000 Make sure all the tokens we're using are defined · Issue #6305 · patternfly/patternfly · GitHub
[go: up one dir, main page]

Skip to content

Make sure all the tokens we're using are defined #6305

@mcoker

Description

@mcoker

We may be using renamed/outdated tokens in our components, so we should check for that and update where needed. One way could be to get a list of tokens used in all components and search those in our tokens stylesheets. Eg,

for i in `grep -riIho "\-\-pf-t--[a-z0-9_-]*" src/patternfly/components/ | sort | uniq`; do
  if grep -riq -- $i src/patternfly/base/tokens/; then
    echo "FOUND: $i";
  else
    echo "NOT FOUND: $i";
  fi;
done

If it's useful, there is also a script available from a PR that renamed some tokens - #6282 (comment)

// manually created this file at ~/replace (eg, /Users/mcoker/replace)
pf-t--global--border--width--control--active|pf-t--global--border--width--control--clicked
pf-t--global--border--width--button--active|pf-t--global--border--width--button--clicked
pf-t--global--border--width--divider--active|pf-t--global--border--width--divider--clicked
pf-t--global--color--status--unread--default--active|pf-t--global--color--status--unread--default--clicked
pf-t--global--icon--size--body--lg|pf-t--global--icon--size--font--body--lg
pf-t--global--icon--size--body--default|pf-t--global--icon--size--font--body--default
pf-t--global--icon--size--body--sm|pf-t--global--icon--size--font--body--sm
pf-t--global--icon--size--heading--h6|pf-t--global--icon--size--font--heading--h6
pf-t--global--icon--size--heading--h5|pf-t--global--icon--size--font--heading--h5
pf-t--global--icon--size--heading--h4|pf-t--global--icon--size--font--heading--h4
pf-t--global--icon--size--heading--h3|pf-t--global--icon--size--font--heading--h3
pf-t--global--icon--size--heading--h2|pf-t--global--icon--size--font--heading--h2
pf-t--global--icon--size--heading--h1|pf-t--global--icon--size--font--heading--h1
for i in `cat ~/replace`; do
  OLD=`echo $i | cut -d'|' -f1`; # stores the old token name in $OLD
  NEW=`echo $i | cut -d'|' -f2`; # stores the new token name in $NEW
  grep -rIl $OLD src/patternfly/components/ | xargs sed -i "" "s/$OLD/$NEW/g"; # grep is -r recursive, -I non-binary files, -l return only the filename where a match is found, pipe to xargs for a sed s/search/replace/g from stdin
done

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0