Using custom fonts
fountsource
#
With To use a custom a font the best option is to use fountsource, so first check that the desired font is available browsing their docs page. If it is, including it in your project is a three step process:
- Run
npm i @fontsource/montserrat
- Open your
src/layouts/main/index.ts
(if you want to import the fonts on all your project's routes) and import the font and its desired variations, e.g.:
- Open your
src/config/variables.scss
and assign the fonts:
#
With custom font filesThese are the 4 steps to use custom fonts in your project:
- First put your font files (even just
.ttf
format) insrc/assets/fonts
- In file
src/utils/fonts.scss
import your fonts with theFont-face
sass mixin, e.g.:
- Open your
src/layouts/main/index.js
(if you want to import the fonts on all your project's routes) and import that file:
- Open your
src/config/variables.scss
and assign the fonts: