The css-loader README suggests that localIdentName
be set to
'[path][name]__[local]--[hash:base64:5]'
Is the hashing suffix necessary? Would it still be unique as this?
'[path][name]__[local]'
Why or why not?
The fact that #3 is an option in this GitHub Issue discussion leads me to believe it may not be necessary.
The localIdentName
is used along with the modules
options:
{
loader: 'css-loader',
options: {
modules: true,
localIdentName: '[path][name]__[local]--[hash:base64:5]'
}
}
It generates longer class names like:
.src-styles-main__world-grid--R7u-K
--------------- ---------- -----
path,name local hash
.src-styles-main__world-grid
--------------- ----------
path,name local
So, the hash would not be needed as long as path, name and class name generate unique IDs. It is very unlikely that the hash would be needed.
localidentname on webpack 4.35.3
module.exports = {
module: {
rules: [
{
test: /\.css$/i,
loader: 'css-loader',
options: {
modules: {
localIdentName: '[path][name]__[local]--[hash:base64:5]',
},
},
},
],
},
};
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With