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
> Note: this feature is available with `[email protected]` and higher.
7
+
8
+
This project supports [CSS Modules](https://github.com/css-modules/css-modules) alongside regular stylesheets using the `[name].module.css` file naming convention. CSS Modules allows the scoping of CSS by automatically creating a unique classname of the format `[filename]\_[classname]\_\_[hash]`.
9
+
10
+
> **Tip:** Should you want to preprocess a stylesheet with Sass then make sure to [follow the installation instructions](#adding-a-sass-stylesheet) and then change the stylesheet file extension as follows: `[name].module.scss` or `[name].module.sass`.
11
+
12
+
CSS Modules let you use the same CSS class name in different files without worrying about naming clashes. Learn more about CSS Modules [here](https://css-tricks.com/css-modules-part-1-need/).
13
+
14
+
### `Button.module.css`
15
+
16
+
```css
17
+
.error {
18
+
background-color: red;
19
+
}
20
+
```
21
+
22
+
### `another-stylesheet.css`
23
+
24
+
```css
25
+
.error {
26
+
color: red;
27
+
}
28
+
```
29
+
30
+
### `Button.js`
31
+
32
+
```js
33
+
importReact, { Component } from'react';
34
+
importstylesfrom'./Button.module.css'; // Import css modules stylesheet as styles
<!-- This button has red background but not red text -->
51
+
<buttonclass="Button_error_ax7yz"></div>
52
+
```
53
+
54
+
**This is an optional feature.** Regular `<link>` stylesheets and CSS files are fully supported. CSS Modules are turned on for files ending with the `.module.css` extension.
-[Alternatives to Ejecting](#alternatives-to-ejecting)
48
47
49
-
## Adding a CSS Modules Stylesheet
50
-
51
-
> Note: this feature is available with `[email protected]` and higher.
52
-
53
-
This project supports [CSS Modules](https://github.com/css-modules/css-modules) alongside regular stylesheets using the `[name].module.css` file naming convention. CSS Modules allows the scoping of CSS by automatically creating a unique classname of the format `[filename]\_[classname]\_\_[hash]`.
54
-
55
-
> **Tip:** Should you want to preprocess a stylesheet with Sass then make sure to [follow the installation instructions](#adding-a-sass-stylesheet) and then change the stylesheet file extension as follows: `[name].module.scss` or `[name].module.sass`.
56
-
57
-
CSS Modules let you use the same CSS class name in different files without worrying about naming clashes. Learn more about CSS Modules [here](https://css-tricks.com/css-modules-part-1-need/).
58
-
59
-
### `Button.module.css`
60
-
61
-
```css
62
-
.error {
63
-
background-color: red;
64
-
}
65
-
```
66
-
67
-
### `another-stylesheet.css`
68
-
69
-
```css
70
-
.error {
71
-
color: red;
72
-
}
73
-
```
74
-
75
-
### `Button.js`
76
-
77
-
```js
78
-
importReact, { Component } from'react';
79
-
importstylesfrom'./Button.module.css'; // Import css modules stylesheet as styles
<!-- This button has red background but not red text -->
96
-
<buttonclass="Button_error_ax7yz"></div>
97
-
```
98
-
99
-
**This is an optional feature.** Regular `<link>` stylesheets and CSS files are fully supported. CSS Modules are turned on for files ending with the `.module.css` extension.
100
-
101
48
## Adding a Sass Stylesheet
102
49
103
50
> Note: this feature is available with `[email protected]` and higher.
0 commit comments