Skip to content
This repository was archived by the owner on Jan 15, 2019. It is now read-only.

Commit a663759

Browse files
committed
Add a README
1 parent e3aec5d commit a663759

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

README.md

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# react-app-rewire-css-modules
2+
3+
Add [CSS Module](https://github.com/css-modules/css-modules) loaders to your [create-react-app](https://github.com/facebookincubator/create-react-app) via [react-app-rewired](https://github.com/timarney/react-app-rewired).
4+
5+
CSS Module styles can be written in CSS or SASS.
6+
7+
## Installation
8+
9+
This package is not yet published to the npm registry. Install from GitHub:
10+
11+
```
12+
yarn add --dev codebandits/react-app-rewire-css-modules sass-loader node-sass
13+
```
14+
15+
OR
16+
17+
```
18+
npm install --save-dev codebandits/react-app-rewire-css-modules sass-loader node-sass
19+
```
20+
21+
## Usage
22+
23+
In your react-app-rewired configuration:
24+
25+
```javascript
26+
/* config-overrides.js */
27+
28+
const rewireCssModules = require('react-app-rewire-css-modules');
29+
30+
module.exports = function override(config, env) {
31+
// ...
32+
config = rewireCssModules(config, env);
33+
// ...
34+
return config;
35+
}
36+
```
37+
38+
In your React application:
39+
40+
```scss
41+
// src/App.scss
42+
43+
.app {
44+
color: aqua;
45+
46+
&:hover {
47+
color: lawngreen;
48+
}
49+
}
50+
```
51+
52+
```jsx harmony
53+
// src/App.js
54+
55+
import React from 'react';
56+
import styles from './App.scss';
57+
58+
export default ({text}) => (
59+
<div className={styles.app}>{text}</div>
60+
)
61+
```

0 commit comments

Comments
 (0)