Next.js Discord

Discord Forum

Importing Font From Another Server?

Unanswered
Palomino posted this in #help-forum
Open in Discord
PalominoOP
Is there a way I can import fonts hosted on another server and assign them to font variables that are used by tailwind?

For example, this is how I'm using the fonts in the next application.
import localFont form "next/font/local";
import { cn } from "@/lib/utils";

const helveticaNeue = localFont({
  src: [
    {
      path: "../../assets/fonts/HelveticaNeue-Thin.woff2",
      weight: "100",
    },
  ],
  variable: "--helvetica-neue",
});

const fontVariables = cn(
  `${helveticaNeue.variable}`
);

export { fontVariables };


But what I would like to do is change the path to be on another server, like so. Is this even possible?
path: "https://www.site.com/fonts/HelveticaNeue-Thin.woff2"

3 Replies