You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, when we monitoring online traffic and user interactions, we tends to record class names and ids. Short class names can be confusing. For example, many components may have .image:
.image_l2sjf {}
.image_xrfs1 {}
.image_xeqwk {}
It is hard to know which component the .image class name belongs to.
Suggested solution
I suggest to support a special query parameter prefix to add extra context for class names:
Why do you think having a query parameter is better than using generateScopedName?
a query parameter allows you to handle complex situation, while generateScopedName is a static rule based on filepath etc. For example
// full path is src/order/product/index.module.cssimportstylesfrom'./index.module.css?prefix=OrderProduct';// full path is src/order/product/Cover.module.cssimportstylesfrom'./Cover.module.css?prefix=OrderProductStatus';
Both query parameter and generateScopedName have their advantages.
Description
In CSS module, we would like to write shorter class names:
However, when we monitoring online traffic and user interactions, we tends to record class names and ids. Short class names can be confusing. For example, many components may have
.image
:It is hard to know which component the
.image
class name belongs to.Suggested solution
I suggest to support a special query parameter
prefix
to add extra context for class names:Which will generate css like this:
Alternative
According to this article, Create React App can automatically prefix css module class name with the file name:
Vite doesn't support this magic out-of-box, but you can achieve it by config:
Additional context
No response
Validations
The text was updated successfully, but these errors were encountered: