CSS-in-JS-generator icon indicating copy to clipboard operation
CSS-in-JS-generator copied to clipboard

hyphen removal in class names

Open jimthedev opened this issue 8 years ago • 2 comments

.display2 {
  color: 'red';
}
.display-2 {
    font-size: 5.5rem;
    font-weight: 300;
    line-height: 1.1;
}

These seem to generate the same class name in JS:

export const display2 = css`
  font-size: 5.5rem;
  font-weight: 300;
  line-height: 1.1;
`;
export const display2 = css`color: "red";`;

Not sure if there is a good solution.

jimthedev avatar Oct 08 '17 12:10 jimthedev

You are right, classnames are camelized, and so this can lead to something wrong... I don't have the answer right now, but having both display-2 and display2 is an edge case, as library is still experimental.

brikou avatar Oct 10 '17 12:10 brikou

push the class name to an array and check whether it already exists. If yes, add a suffix that can be a unique id.

ritz078 avatar Dec 08 '17 10:12 ritz078