gajus / gajus/babel-plugin-react-css-modules
Document how to use with create-react-app
- Dominant language
- JavaScript
- Stars
- 2k
- Forks
- 159
- PR merge metrics
- No merged PRs in 30d
Description
tl;dr;
Use https://github.com/sharegate/craco.
Create `craco.config.js`:
```js
const CSS_MODULE_LOCAL_IDENT_NAME = '[local]___[hash:base64:5]';
module.exports = {
style: {
modules: {
camelCase: true,
localIdentName: CSS_MODULE_LOCAL_IDENT_NAME
}
},
babel: {
loaderOptions: {
// Without this Babel caches module name resolution,
// e.g. wrongly identifies that CSS module does not exist.
cacheDirectory: false,
},
plugins: [
[
'babel-plugin-react-css-modules',
{
attributeNames: {
activeStyleName: 'activeClassName'
},
filetypes: {
'.scss': {
syntax: 'postcss-scss'
}
},
generateScopedName: CSS_MODULE_LOCAL_IDENT_NAME,
handleMissingStyleName: 'warn'
}
]
]
}
};
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.