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
I suggest adding support for CSS Modules with an explicit filename, allowing those who wish to use CSS Modules to do so without interfering with importing regular stylesheets including from external packages.
What is CSS Modules CSS Modules will autogenerate a classname with hash to insure scoped classnames. This means that you no longer have to worry about clashing classnames or using BEM or similar naming convention. It does this in the background when CSS is being generated.
To quote CSS Modules: No more conflicts, explicit dependencies, no global scope.
Explicit file name
[name].modules.css
Regex
CSS Module: /\.modules.css$/
Not Module: /[^\.modules]\.css$/
Reasoning
CSS Modules is widely used, has excellent satisfaction (97%) according to StateOfJS. It also allows an easy alternative with IDE support from CSSinJS solutions and wont interfere with regular css.
Opt-in only
The feature would be entirely optional and a user would have to explicitly opt in by using the naming convention and importing the css file into a JS file.
Gotchas
If someone named a stylesheet [something].modules.css without it actually being a CSS Module and imported it, it would be imported as a CSS Module.
I suggest adding support for CSS Modules with an explicit filename, allowing those who wish to use CSS Modules to do so without interfering with importing regular stylesheets including from external packages.
What is CSS Modules
CSS Modules will autogenerate a classname with hash to insure scoped classnames. This means that you no longer have to worry about clashing classnames or using BEM or similar naming convention. It does this in the background when CSS is being generated.
To quote CSS Modules: No more conflicts, explicit dependencies, no global scope.
Explicit file name
[name].modules.css
Regex
CSS Module:
/\.modules.css$/
Not Module:
/[^\.modules]\.css$/
Reasoning
CSS Modules is widely used, has excellent satisfaction (97%) according to StateOfJS. It also allows an easy alternative with IDE support from CSSinJS solutions and wont interfere with regular css.
Opt-in only
The feature would be entirely optional and a user would have to explicitly opt in by using the naming convention and importing the css file into a JS file.
Gotchas
If someone named a stylesheet [something].modules.css without it actually being a CSS Module and imported it, it would be imported as a CSS Module.
Pull Request
PR #2285
Thoughts?
The text was updated successfully, but these errors were encountered: