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

.d.ts keys are camelCased #5

Open
RoystonS opened this issue Apr 23, 2019 · 1 comment
Open

.d.ts keys are camelCased #5

RoystonS opened this issue Apr 23, 2019 · 1 comment

Comments

@RoystonS
Copy link
Contributor

Hi there,

I've just been playing about with an app created by create-react-app, and its App.css file comes with CSS classes such as App-logo and App-header. Changing that to App.module.scss and running sass-module-types gives me a .module.scss.d.ts file with the contents

export const App: string;
export const AppLogo: string;
export const AppHeader: string;
export const AppLink: string;
export default {} as {
  App: string,
  AppLogo: string,
  AppHeader: string,
  AppLink: string,
}

That looks nice enough, but the names don't match the class names, e.g. AppLogo instead of App-logo. The names such as App-logo are the ones I actually get out of webpack.

I suspect you've got some workaround for this: your front page example uses, for example, class gray-1 but you refer to it in your code as gray1. If that works, you must have something in your webpack (or similar) chain that remaps the exported CSS class names as camel case? Could you share the documentation for that please? Thanks!

@RoystonS
Copy link
Contributor Author

I've discovered the camelCase option for the webpack css-loader, but that produces lower-case camel-case, e.g. an original App-header CSS class name is transformed to appHeader whereas sass-module-types generates AppHeader instead.

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

No branches or pull requests

1 participant