Skip to content

Make the class name meaningful rather than random numbers and letters. #439

Discussion options

You must be logged in to vote

Hey,

There multiple reasons why we can't use anything human readable, mainly it's complexity and bundle size. Let me provide multiple examples:

makeStyles({
  root: { color: 'red' }
});
// ⬇️⬇️⬇️
// .cred { color: red }

In the simple example it looks fine 👍 But what about usage of rbga values or CSS variables? ⬇️

makeStyles({
  rootA: { color: 'rgba(255,0,0,0.3)' },
  rootB: { color: 'var(--colorNeutralForeground1)' }
});
// ⬇️⬇️⬇️
// .c25500003 { color: rgba(255,0,0,0.3) } 🤔 
// .cvarcolorNeutralForeground1 { color: var(--colorNeutralForeground1) } 🤔 

Okay, but what about properties themselves? Let's assume what use first letter and other capitals to generate classes:

makeStyles({
  rootA: 

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by khmakoto
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants