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
Whether you use babel plugin to turn on CSS Modules specifically for JSX (e.g. [babel-plugin-react-css-modules](https://github.com/gajus/babel-plugin-react-css-modules)) or use webpack loader for that to transform styles into key-value object, it's possible to use it with pug.
135
+
136
+
* With [babel-plugin-react-css-modules](https://github.com/gajus/babel-plugin-react-css-modules) you need to set [`classAttribute`](#classattribute) option to `styleName` value and that's it.
137
+
138
+
```rc
139
+
{
140
+
"plugins": [
141
+
["transform-react-pug", {
142
+
"classAttribute": "styleName"
143
+
}]
144
+
]
145
+
}
146
+
```
147
+
148
+
```jsx
149
+
import'./styles.css'// .hello{color:red}
150
+
151
+
constwithCorrectStyles= pug`
152
+
div.hello I am a red text
153
+
`
154
+
```
155
+
156
+
* With webpack loader or other approaches which transform styles into object
The developer experience can be improved here by setting [`classAttribute`](#classattribute) option to `styleName` value and adding [babel-plugin-transform-jsx-css-modules](https://github.com/ezhlobo/babel-plugin-transform-jsx-css-modules)
0 commit comments