Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replaced Typefaces with Fontsource #24726

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 6 additions & 6 deletions docs/docs/recipes/styling-css.md
Original file line number Diff line number Diff line change
Expand Up @@ -399,18 +399,18 @@ Hosting your own [Google Fonts](https://fonts.google.com/) locally within a proj

- A [Gatsby site](/docs/quick-start)
- The [Gatsby CLI](/docs/gatsby-cli/) installed
- Choosing a font package from [the typefaces project](https://github.com/KyleAMathews/typefaces)
- Choosing a font package from the [fontsource project](https://github.com/DecliningLotus/fontsource)

### Directions

1. Run `npm install --save typeface-your-chosen-font`, replacing `your-chosen-font` with the name of the font you want to install from [the typefaces project](https://github.com/KyleAMathews/typefaces).
1. Run `npm install fontsource-your-chosen-font`, replacing `your-chosen-font` with the name of the font you want to install from the [fontsource project](https://github.com/DecliningLotus/fontsource).

An example to load the popular 'Source Sans Pro' font would be: `npm install --save typeface-source-sans-pro`.
An example to load the popular 'Source Sans Pro' font would be: `npm install fontsource-source-sans-pro`.

2. Add `import "typeface-your-chosen-font"` to a layout template, page component, or `gatsby-browser.js`.
2. Add `import "fontsource-your-chosen-font"` to a layout template, page component, or `gatsby-browser.js`.

```jsx:title=src/components/layout.js
import "typeface-your-chosen-font"
import "fontsource-your-chosen-font"
```

3. Once it's imported, you can reference the font name in a CSS stylesheet, CSS Module, or CSS-in-JS.
Expand All @@ -426,7 +426,7 @@ _NOTE: So for the above example, the relevant CSS declaration would be `font-fam
### Additional resources

- [Typography.js](/docs/typography-js/) - Another option for using Google fonts on a Gatsby site
- [The Typefaces Project Docs](https://github.com/KyleAMathews/typefaces/blob/master/README.md)
- [Fontsource](https://github.com/DecliningLotus/fontsource/blob/master/packages/roboto/README.md)
- [Live example on Kyle Mathews' blog](https://www.bricolage.io/typefaces-easiest-way-to-self-host-fonts/)

## Using Font Awesome
Expand Down