Description
- Operating System: macOS 10.15.6
- Node Version: 12.18.4
- NPM Version: 6.14.6
- webpack Version: 4.44.2
- css-loader Version: 4.3.0
Feature Proposal
When I set css-loader options like this:
{
loader: 'css-loader',
options: {
modules: {
namedExport: true,
exportLocalsConvention: 'dashesOnly',
},
}
},
The loader emits an error for each CSS file: The "modules.namedExport" option requires the "modules.exportLocalsConvention" option to be "camelCaseOnly"
.
I understand that class names mustn't contain dashes and many other characters to be able to be constant names, but underscore (_
) is allowed and I want to use it in constant names.
In order to achieve this, there can be a value like leaveUnderscore
for the exportLocalsConvention
option that shall camelize everything except underscores and be accepted when namedExports
is true
.
Feature Use Case
BEM. Even though CSS modules make BEM be completely meaningless, underscore can be used to split logical parts in CSS class names, especially when CSS is produced by a preprocessor. For example, here is my SCSS:
.bigButton {
&_label {
}
}
.label {
&_icon {
}
}
I want to use the class names as is:
import {bigButton, bigButton_label, label, label_icon} from './style.scss?module';
Having 2 ways to split words (camelCase and under_score) is very handy for giving meaningful names to CSS items.