Skip to content

Classes in the common stylesheet are duplicated for every component #95

@iPapatsoris

Description

@iPapatsoris

Hi,

In the example react-sass, I notice that for the common styles file (src/assets/styles/_index.scss), a different css module class is generated for every component that imports styles. For example, 2 different css module classes are generated for the .row class, because there are 2 files that import styles (App.tsx and User.tsx). This happens even if we don't directly use the .row class within User.tsx. In a larger project, it means that all the classes within the common stylesheet will be duplicated for every component that uses styles, even though we only need 1 instance of each common class.

Is it possible to generate only 1 class for .row, and reuse the same one across different files, while maintaining type safety? Or is there some other workaround to get the desired behavior?

Thanks!

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions