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

Kebab case support for CSS selectors #193

Open
KaneFreeman opened this issue Oct 26, 2018 · 0 comments
Open

Kebab case support for CSS selectors #193

KaneFreeman opened this issue Oct 26, 2018 · 0 comments

Comments

@KaneFreeman
Copy link
Member

KaneFreeman commented Oct 26, 2018

Enhancement

Package Version: 4.0.0

Code

widget.m.css

.selecter-1 { }

.selecter2 { }

widget.m.css.d.ts

export const selecter2: string;

Expected behavior:

A type definition should be generated for .selector-1.

Actual behavior:

Currently .selector-1 is ignored and no type definition is generated.

Suggestion
This would be a breaking change, but would solve this issue without having to convert the names to something else (and potentially causing conflicts).

Instead of the current definition files that are generated:

export const selecter2: string;

You generate a class with static members. These can be defined with quotes around them, allowing for kebab case.

export default class css {
	static 'selector-1': string;
	static selector2: string;
}

Imports for the CSS would be where the breaking change occurs. You would need to change the import from:

import * as css from '../styles/widget.m.css';

to:

import css from '../styles/widget.m.css';

But the type check will still work.

  • css['selector-1'] - Valid
  • css.selector2 - Valid
  • css['selector-n'] - Property 'selector-n' does not exist on type 'typeof css'.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant