You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Make syntax parser configurable
* Make syntax parser configurable
* fix: handle multiple file import with dynamic resolution (fixes#7#11#13#14#17) (#12)
* fix: added escape hatch when testing attribute that do not have a name property (#11)
* fix: object expression generated on dynamic resolution now use quote to escape properties' name (#14)
* fix: getClassName now works as expected when multiple file use runtime resolution
* fix: getClassName now works as expected when multiple file use runtime resolution
* fix: generate className when using runtime resolution (#18) (#19)
* fix: added escape hatch when testing attribute that do not have a name property (#11)
* fix: object expression generated on dynamic resolution now use quote to escape properties' name (#14)
* fix: getClassName now works as expected when multiple file use runtime resolution
* fix: getClassName now works as expected when multiple file use runtime resolution
* fix: className attribute is now correctly generated when using runtime resolution (#18)
* feat: improve error messages (#21)
* Make syntax parser configurable
* Merged upstream
* Updated the configuration section of the readme file
* docs: improve wording
* fix: add a missing comma
BREAKING CHANGE:
If your installation is using CSS, now you need to manually install scss-loader and configure it. https://github.com/gajus/babel-plugin-react-css-modules#configurate-syntax-loaders
|`generateScopedName`|Refer to [Generating scoped names](https://github.com/css-modules/postcss-modules#generating-scoped-names)|`[path]___[name]__[local]___[hash:base64:5]`|
171
171
|`context`|Must match webpack [`context`](https://webpack.github.io/docs/configuration.html#context) configuration. [`css-loader`](https://github.com/webpack/css-loader) inherits `context` values from webpack. Other CSS module implementations might use different context resolution logic.|`process.cwd()`|
172
+
|`filetypes`|Configure [postcss syntax loaders](https://github.com/postcss/postcss#syntaxes) like sugerss, LESS and SCSS. ||
173
+
|`generateScopedName`|Refer to [Generating scoped names](https://github.com/css-modules/postcss-modules#generating-scoped-names)|`[path]___[name]__[local]___[hash:base64:5]`|
172
174
173
175
Missing a configuration? [Raise an issue](https://github.com/gajus/babel-plugin-react-css-modules/issues/new?title=New%20configuration:).
174
176
175
177
> Note:
176
178
> The default configuration should work out of the box with the [css-loader](https://github.com/webpack/css-loader).
177
179
180
+
### Configurate syntax loaders
181
+
182
+
To add support for different CSS syntaxes (e.g. SCSS), perform the following two steps:
183
+
184
+
1. Add the [postcss syntax loader](https://github.com/postcss/postcss#syntaxes) as a development dependency:
185
+
186
+
```bash
187
+
npm install postcss-scss --save-dev
188
+
```
189
+
190
+
2. Add a filetype syntax mapping to the Babel plugin configuration
191
+
192
+
```json
193
+
"filetypes": {
194
+
".scss": "postcss-scss"
195
+
}
196
+
```
197
+
178
198
## Installation
179
199
180
200
When `babel-plugin-react-css-modules` cannot resolve CSS module at a compile time, it imports a helper function (read [Runtime `styleName` resolution](#runtime-stylename-resolution)). Therefore, you must install `babel-plugin-react-css-modules` as a direct dependency of the project.
0 commit comments