-
-
Notifications
You must be signed in to change notification settings - Fork 161
Is composes
supposed to work?
#192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Whats the definition of |
Oh sorry, I tried to include as much as I can. I took this function from this medium article and changed it slightly. const incstr = require('incstr')
const path = require('path')
const createUniqueIdGenerator = () => {
const index = {}
const generateNextId = incstr.idGenerator({
alphabet: 'abcdefghijklmnopqrstuvwxyz0123456789'
})
return (name) => {
if (index[name]) {
return index[name]
}
let nextId
// class name cannot start with a number
// and it cannot start with 'ad' otherwise adblocks will hide the element
do {
nextId = generateNextId()
} while (/^[0-9]/.test(nextId) || /^ad/.test(nextId))
index[name] = process.env.NODE_ENV === 'development'
? `${name}-${nextId}`
: nextId
return index[name]
}
}
const uniqueIdGenerator = createUniqueIdGenerator()
const generateScopedName = (localName, resourcePath) => {
let componentName = resourcePath.split(path.sep).slice(-2, -1)
if (componentName === "theme") {
componentName = `${componentName}.${resourcePath.split(path.sep).slice(-1, -1)}`
}
return `${uniqueIdGenerator(componentName)}_${uniqueIdGenerator(localName)}`
} and my .babelrc {
"presets": [
["env", {
"modules": false,
"targets": {
"browsers": ["> 0.5%"]
}
}],
"stage-2",
"react"
],
"env": {
"server": {
"presets": [["env", {
"targets": {
"node": "8.9.1"
}
}], "react"],
"plugins": [
"transform-decorators-legacy",
"transform-class-properties",
"react-loadable/babel"
]
}
}
} |
And also my css-loader config: {
test: /\.css$/,
use: [
{
loader: require.resolve('style-loader'),
options: {
insertInto: 'body',
},
},
{
loader: require.resolve('css-loader'),
options: {
importLoaders: 1,
modules: true,
getLocalIdent: (context, localIdentName, localName) => {
return generateScopedName(localName, context.resourcePath)
},
},
},
{
loader: require.resolve('postcss-loader'),
},
],
}, |
Perhaps it is my local set up that is incorrect. If I remove I see in the DOM:
But in the CSS I see:
If you are still interested, I can give you a repo to check out? Edit: I see you need to match them so I understand why this doesn't work lol. Although my first question and the offer to share a reproduceable repo still stands. |
Probably duplicate of: |
My class name is correct:
<h2 class="PageTitle_root theme_h2 theme_heading">Shopping</h2>
. However the CSS is not:As you can see, the PageTitle CSS is generating the class name correctly, but the theme/type.css file is not. What's up with that?
My config is this:
The text was updated successfully, but these errors were encountered: