Skip to content

Disallow or gracefully handle CSS selectors with hyphens (ie. ".main--red") #6

@silbinarywolf

Description

@silbinarywolf

The problem
If you use hypens in your CSS selectors, it will generate a *.d.ts file that has compilation errors.
For example, the following SCSS file:

.main {
  border: 1px solid black;

  &--red {
    border-color: red;
  }
}

becomes:

// This file is automatically generated.
// Please do not change this file!
export const main: string;
export const main--red: string; // ERROR ON THIS LINE

The solution
At the very least, I think this tool should probably throw some kind of error. I'm not keen on the idea of making it transform into an identifier that doesn't map 1-1 with the original CSS selector name.

EDIT: I'd be interested to know what conventions you guys follow if it isn't BEM, ie. slight permutations on an element, such as it having an alternate color or skin.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions