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
-[Progressive Web App Metadata](#progressive-web-app-metadata)
@@ -470,6 +472,20 @@ Now you can rename `src/App.css` to `src/App.scss` and run `npm run watch-css`.
470
472
471
473
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.
472
474
475
+
To enable importing files without using relative paths, you can add the `--include-path` option to the command in `package.json`.
@import'styles/_colors.scss'; // assuming a styles directory under src/
486
+
@import'nprogress/nprogress'; // importing a css file from the nprogress node module
487
+
```
488
+
473
489
At this point you might want to remove all CSS files from the source control, and add `src/**/*.css` to your `.gitignore` file. It is generally a good practice to keep the build products outside of the source control.
474
490
475
491
As a final step, you may find it convenient to run `watch-css` automatically with `npm start`, and run `build-css` as a part of `npm run build`. You can use the `&&` operator to execute two scripts sequentially. However, there is no cross-platform way to run two scripts in parallel, so we will install a package for this:
@@ -563,7 +579,7 @@ The `<script>` tag with the compiled code will be added to it automatically duri
563
579
You can also add other assets to the `public` folder.
564
580
565
581
Note that we normally encourage you to `import` assets in JavaScript files instead.
566
-
For example, see the sections on [adding a stylesheet](#adding-a-stylesheet) and [adding images and fonts](#adding-images-and-fonts).
582
+
For example, see the sections on [adding a stylesheet](#adding-a-stylesheet) and [adding images and fonts](#adding-images-fonts-and-files).
567
583
This mechanism provides a number of benefits:
568
584
569
585
* Scripts and stylesheets get minified and bundled together to avoid extra network requests.
@@ -603,7 +619,7 @@ Keep in mind the downsides of this approach:
603
619
604
620
### When to Use the `public` Folder
605
621
606
-
Normally we recommend importing [stylesheets](#adding-a-stylesheet), [images, and fonts](#adding-images-and-fonts) from JavaScript.
622
+
Normally we recommend importing [stylesheets](#adding-a-stylesheet), [images, and fonts](#adding-images-fonts-and-files) from JavaScript.
607
623
The `public` folder is useful as a workaround for a number of less common cases:
608
624
609
625
* You need a file with a specific name in the build output, such as [`manifest.webmanifest`](https://developer.mozilla.org/en-US/docs/Web/Manifest).
0 commit comments