My main font in gatsby is defined in the index.scss folder like this in a body tag.
body {
font-family: "Trebuchet MS", "Helvetica";
font-size: 16px;
}
For the title I want to use the google font and I have tried to preload using these plugins:
{
resolve: `gatsby-plugin-google-fonts`,
options: {
fonts: [`Sacramento`],
display: "swap",
},
},
{
resolve: `gatsby-plugin-prefetch-google-fonts`,
options: {
fonts: [
{
family: `Sacramento`,
variants: [`400`],
},
],
},
},
{
resolve: "gatsby-plugin-web-font-loader",
options: {
google: {
families: ["Sacramento"],
},
},
},
In the css font is defined but still getting the flash of unstyled text in production not locally in development.
.title {
font-family: "Sacramento", cursive;
}