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
Copy file name to clipboardExpand all lines: packages/react-scripts/template/README.md
+42
Original file line number
Diff line number
Diff line change
@@ -18,6 +18,7 @@ You can find the most recent version of this guide [here](https://github.com/fac
18
18
-[Importing a Component](#importing-a-component)
19
19
-[Adding a Stylesheet](#adding-a-stylesheet)
20
20
-[Post-Processing CSS](#post-processing-css)
21
+
-[Adding SASS Support](#adding-sass-support)
21
22
-[Adding Images and Fonts](#adding-images-and-fonts)
22
23
-[Using the `public` Folder](#using-the-public-folder)
23
24
-[Adding Bootstrap](#adding-bootstrap)
@@ -301,6 +302,47 @@ becomes this:
301
302
302
303
There is currently no support for preprocessors such as Less, or for sharing variables across CSS files.
303
304
305
+
## Adding SASS Support
306
+
307
+
CSS preprocessors have become a vital part of build processes. Using a preprocesssor of your choice in a project bootstrapped using create-react-app, is fairly straightforward to setup, even without having to eject.
308
+
309
+
First, install preprocessor of your choice. SASS seems the most popular weapon of choice at the moment, so we'll use it as an example.
310
+
311
+
```
312
+
npm install node-sass --save-dev
313
+
```
314
+
315
+
Then in `package.json` just add the following lines to `scripts`, replacing file paths accordingly.
> Using a different preprocessor should be just a matter of replacing `build-css` and `watch-css` scripts to something that matches the preprocessor you're using.
328
+
329
+
Add these scripts to the main scripts, by pasting `npm run watch-css &` to `start` script and `npm run build-css &&` to `build`.
330
+
331
+
```
332
+
...
333
+
"scripts": {
334
+
"start": "npm run watch-css & react-scripts start",
335
+
"build": "npm run build-css && react-scripts build",
0 commit comments