Closed gfcf14 closed 5 years ago
@gfcf14 Create a demo repository that shows this problem. At the moment it's hard to guess what's wrong.
I see one problem, you define in .babelrc
"generateScopedName" : "[local]___[hash:base64:5]"
but your webpack config has
localIdentName: '[path]__[name]___[local]'
They should be the same.
From the README.md
Refer to Generating scoped names. If you use this option, make sure it matches the value of localIdentName in webpack config. See this issue
@hinok I changed the value for generateScopedName
to match the one in webpack and now I'm getting this error:
Error: Could not resolve the styleName 'not-found-rct-component__text-section'.
The only class I have right now, not-found.jsx
, has a starting structure like this:
<Flex as="section" styleName="not-found-rct-component">
<section styleName="not-found-rct-component__text-section">
<section>
Given that I am using styleName
before the text-section
, I would assume the one for the Flex
is correct, so it would be working. My SCSS file has a structure like this:
.not-found-rct-component {
.
.
.
&__text-section {
.
.
.
.center-text {
.
.
.
}
}
}
Is it that I am missing something for how I'm supposed to structure nested classes in SCSS? Please let me know. I'll try to get you the demo repository asap. Thanks!
You need postcss-nested
in your .babelrc
so it should look like
{
"plugins": [
[
"react-css-modules",
{
"attributeNames": {
"styleName": "className"
},
"filetypes": {
".scss": {
"syntax": "postcss-scss",
"plugins": [
[
"postcss-nested",
{
"bubble": ["@include"],
"preserveEmpty": true
}
]
]
}
},
"generateScopedName": "[local]___[hash:base64:5]"
}
]
]
}
I'm trying to implement this to my current razzle project, but it appears the
styleName
property disappears upon compiling. My.babelrc
looks like this:And, although razzle keeps a file,
razzle.config.js
, where it provides webpack configuration, I outputted and it looks like this:Is there an option I should try to overwrite? I'm sorry that I would have to ask here, but I haven't been receiving response from the razzle people for another issue and am not sure if they would be prompt to reply something like this. Please let me know if there is a configuration I'm doing wrong