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: docusaurus/docs/adding-a-sass-stylesheet.md
+23-18
Original file line number
Diff line number
Diff line change
@@ -10,42 +10,36 @@ Generally, we recommend that you don’t reuse the same CSS classes across diffe
10
10
11
11
Following this rule often makes CSS preprocessors less useful, as features like mixins and nesting are replaced by component composition. You can, however, integrate a CSS preprocessor if you find it valuable.
12
12
13
-
To use Sass, first install `node-sass`:
13
+
To use Sass, first install `sass`:
14
14
15
15
```sh
16
-
$ npm install node-sass --save
17
-
$ # or
18
-
$ yarn add node-sass
16
+
$ npm install sass
17
+
# or
18
+
$ yarn add sass
19
19
```
20
20
21
21
Now you can rename `src/App.css` to `src/App.scss` and update `src/App.js` to import `src/App.scss`.
22
22
This file and any other file will be automatically compiled if imported with the extension `.scss` or `.sass`.
23
23
24
-
To share variables between Sass files, you can use Sass imports. For example, `src/App.scss` and other component style files could include `@import "./shared.scss";` with variable definitions.
24
+
To share variables between Sass files, you can use Sass's [`@use` rule](https://sass-lang.com/documentation/at-rules/use). For example, `src/App.scss` and other component style files could include `@use "./shared.scss";` with variable definitions.
25
25
26
26
This will allow you to do imports like
27
27
28
28
```scss
29
-
@import'styles/_colors.scss'; // assuming a styles directory under src/
30
-
@import'~nprogress/nprogress'; //importing a css file from the nprogress node module
29
+
@use'styles/_colors.scss'; // assuming a styles directory under src/
30
+
@use'~nprogress/nprogress'; //loading a css file from the nprogress node module
31
31
```
32
32
33
-
> **Note:** You must prefix imports from `node_modules`with `~` as displayed above.
33
+
> **Note:** You can prefix paths with `~`, as displayed above, to resolve modules from `node_modules`.
34
34
35
-
`node-sass` also supports the `SASS_PATH` variable.
35
+
`sass` also supports the `SASS_PATH` variable.
36
36
37
-
To use imports relative to a path you specify, and from `node_modules` without adding the `~` prefix, you can add a [`.env` file](https://github.com/facebook/create-react-app/blob/master/docusaurus/docs/adding-custom-environment-variables.md#adding-development-environment-variables-in-env) at the project root with the variable `SASS_PATH=node_modules:src`. To specify more directories you can add them to `SASS_PATH` separated by a `:` like `path1:path2:path3`.
37
+
To use imports relative to a path you specify, you can add a [`.env` file](https://github.com/facebook/create-react-app/blob/master/docusaurus/docs/adding-custom-environment-variables.md#adding-development-environment-variables-in-env) at the project root with the path specified in the `SASS_PATH` environment variable. To specify more directories you can add them to `SASS_PATH` separated by a `:` like `path1:path2:path3`.
38
38
39
-
If you set `SASS_PATH=node_modules:src`, this will allow you to do imports like
40
-
```scss
41
-
@import'styles/colors'; // assuming a styles directory under src/, where _colors.scss partial file exists.
42
-
@import'nprogress/nprogress'; // importing a css file from the nprogress node module
43
-
```
44
-
45
-
> **Note:** For windows operating system, use below syntax
39
+
> **Note:** For the Windows operating system, separate your paths by semicolons.
46
40
>
47
41
> ```
48
-
> SASS_PATH=./node_modules;./src
42
+
> SASS_PATH=path1;path2;path3
49
43
> ```
50
44
51
45
> **Tip:** You can opt into using this feature with [CSS modules](adding-a-css-modules-stylesheet.md) too!
@@ -61,3 +55,14 @@ If you set `SASS_PATH=node_modules:src`, this will allow you to do imports like
61
55
> module.file_ext=.sass
62
56
> module.file_ext=.scss
63
57
> ```
58
+
59
+
> **Note:** LibSass and the packages built on top of it, including Node Sass, are [deprecated](https://sass-lang.com/blog/libsass-is-deprecated).
60
+
> If you're a user of Node Sass, you can migrate to Dart Sass by replacing `node-sass` in your `package.json` file with `sass` or by running the following commands:
Copy file name to clipboardexpand all lines: docusaurus/docs/adding-bootstrap.md
+6-6
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ While you don’t have to use any specific library to integrate Bootstrap with R
8
8
Each project's respective documentation site has detailed instructions for installing and using them. Both depend on the Bootstrap css file so install that as well:
9
9
10
10
```sh
11
-
npm install --save bootstrap
11
+
npm install bootstrap
12
12
```
13
13
14
14
Alternatively you may use `yarn`:
@@ -33,19 +33,19 @@ Sometimes you might need to tweak the visual styles of Bootstrap (or equivalent
33
33
34
34
As of `react-scripts@2.0.0` you can import `.scss` files. This makes it possible to use a package's built-in Sass variables for global style preferences.
35
35
36
-
To enable `scss` in Create React App you will need to install `node-sass`.
36
+
To enable `scss` in Create React App you will need to install `sass`.
37
37
38
38
```sh
39
-
npm install --save node-sass
39
+
npm install sass
40
40
```
41
41
42
42
Alternatively you may use `yarn`:
43
43
44
44
```sh
45
-
yarn add node-sass
45
+
yarn add sass
46
46
```
47
47
48
-
To customize Bootstrap, create a file called `src/custom.scss` (or similar) and import the Bootstrap source stylesheet. Add any overrides _before_ the imported file(s). You can reference [Bootstrap's documentation](https://getbootstrap.com/docs/4.1/getting-started/theming/#css-variables) for the names of the available variables.
48
+
To customize Bootstrap, create a file called `src/custom.scss` (or similar) and import the Bootstrap source stylesheet. Add any overrides _before_ the imported file(s). You can reference [Bootstrap's documentation](https://getbootstrap.com/docs/4.6/getting-started/theming/#variable-defaults) for the names of the available variables.
49
49
50
50
```scss
51
51
// Override default variables before the import
@@ -55,7 +55,7 @@ $body-bg: #000;
55
55
@import'~bootstrap/scss/bootstrap.scss';
56
56
```
57
57
58
-
> **Note:** You must prefix imports from `node_modules`with `~` as displayed above.
58
+
> **Note:** You can prefix paths with `~`, as displayed above, to resolve modules from `node_modules`.
59
59
60
60
Finally, import the newly created `.scss` file instead of the default Bootstrap `.css` in the beginning of your `src/index.js` file, for example:
0 commit comments