Skip to content

Commit d2eee5b

Browse files
ayuhitoLotus
and
Lotus
authored
Update Fontsource Documentation (#28750)
Co-authored-by: Lotus <[email protected]>
1 parent 7378fcf commit d2eee5b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

docs/docs/recipes/styling-css.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -401,19 +401,19 @@ Hosting your own [Google Fonts](https://fonts.google.com/) locally within a proj
401401

402402
This example shows how to set up the [Open Sans](https://fonts.google.com/specimen/Open+Sans) font. If you have a different Google Font you want to use, you can find the corresponding package in [NPM](https://www.npmjs.com/search?q=fontsource) or the [packages directory in the Fontsource repository](https://github.com/fontsource/fontsource/tree/master/packages).
403403

404-
1. Run `npm install fontsource-open-sans` to download the necessary package files.
404+
1. Run `npm install @fontsource/open-sans` to download the necessary package files.
405405

406406
2. Then within your app entry file or site component, import the font package. It is recommended you import it via the layout template (`layout.js`). However, importing via page component (`index.js`), or `gatsby-browser.js` are viable alternatives.
407407

408408
```jsx:title=src/components/layout.js
409-
import "fontsource-open-sans" // Defaults to weight 400 with all styles included.
409+
import "@fontsource/open-sans" // Defaults to weight 400.
410410
```
411411

412412
If you wish to select a particular weight or style, you may specify it by changing the import path.
413413

414414
```jsx:title=src/components/layout.js
415-
import "fontsource-open-sans/500.css" // Weight 500 with all styles included.
416-
import "fontsource-open-sans/900-normal.css" // Select either normal or italic.
415+
import "@fontsource/open-sans/500.css" // Weight 500.
416+
import "@fontsource/open-sans/900-italic.css" // Loads the italic variant.
417417
```
418418

419419
**Note**: The range of supported weights and styles a font may support is shown in each package's README file.

0 commit comments

Comments
 (0)