My problem is that Docusaurus it is not loading custom fonts. I have the following structure:
website
│
└───src
│ │ pages
│ │ ...
│ │
│ └───css
│ │ custom.css
│
└───static
│
└─── fonts
│
└─── Poppins
│ Poppins-Regular.ttf
│ Poppins-Bold.ttf
I have the fonts inside ../static/fonts/Poppins/ folder and inside my css/custom.css i have the following code:
@font-face {
font-family: 'Poppins-Regular';
src: url('../../static/fonts/Poppins/Poppins-Regular.ttf') format('truetype');
}
@font-face {
font-family: 'Poppins-Bold';
src: url('../../static/fonts/Poppins/Poppins-Bold.ttf') format('truetype');
}
:root {
--ifm-color-primary: #2e32ae;
--ifm-font-family-base: 'Poppins-Regular';
--ifm-heading-font-family: 'Poppins-Bold';
--ifm-font-family-monospace: 'Poppins-Regular';
}
When i rebuild my docusaurus project i have other font generated (maybe default one) which is shown but not the Poppins one.
I have read this issue and try everything in there. Also check and this one. But nothing helps.
Note: Interesting thing it is working when I import the font in custom.css file like
@import url('https://fonts.googleapis.com/css2family=Poppins:wght@400;700&display=swap');
But this doesn't help to me. I want to use it from a local folder.