Next.js Discord

Discord Forum

Font-face failed to download

Answered
Palomino posted this in #help-forum
Open in Discord
Avatar
PalominoOP
is it possible to import a font from another server using the font-face css rule?

I have a file with all of my font imports like so:
fonts.css
@font-face {
  font-family: "Domine";
  src: url('https://www.site.com/assets/fonts/Domine-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
}


global.css
@import url('./fonts.css');

@layer utilities {
  .font-hn {
    font-family: "Domine"
  }
}


But I keep getting an error that 'failed to download font'.
Is this something with the server hosting the font not being able to serve the file or is it something with the next js app?
Answered by Palomino
Yes this works as a way to import fonts from another server to a next js app. The server just needs to give cross-origin access to the app
View full answer

1 Reply

Avatar
PalominoOP
Yes this works as a way to import fonts from another server to a next js app. The server just needs to give cross-origin access to the app
Answer