Skip to content
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

feat: include class content as literal type #195

Conversation

flowreaction
Copy link

Small POC, demonstrating how it would be possible to have the content of a class as the literal type.
The benefit here would be, that on hover over the used style class name, it would show the tooltip info with the CSS that is being applied by it.

WIP
There are still some quirks that need to be worked out.

.i {
  color: orange;

  &-am {
    &-kebab {
      color: green;
      background-color: rgb(255, 0, 0);
      
      &-cased {
        color: red;
      }

      &:hover {
        color: yellow;
      }
    }
  }
}

Would become:

export type Styles = {
  i: "color: orange;";
  "i-am-kebab": 
    `color: green;
    background-color: red;`;
  "i-am-kebab-cased": "color: red;";
  while: "color: blue;";
};

instead of:

export type Styles = {
  i: string;
  "i-am-kebab": string;
  "i-am-kebab-cased": string;
  while: string;
};

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.

1 participant