Skip to content

Instantly share code, notes, and snippets.

@viibhuGupta
Created June 22, 2024 14:52
Show Gist options
  • Save viibhuGupta/6dca95a78710ca03700bb7fe000a057d to your computer and use it in GitHub Desktop.
Save viibhuGupta/6dca95a78710ca03700bb7fe000a057d to your computer and use it in GitHub Desktop.
Font Setup
STEP 1 :
public/fonts put all fonts
1
2
STEP 2 :
// @/utils/coustomFonts.js
import localFont from "next/font/local";
const gtRG = localFont({
src: [{ path: "../public/assets/fonts/gtRG.woff2" }],
variable: "--font-gtRG",
});
const gtTrial = localFont({
src: [{ path: "../public/assets/fonts/gtTrial.woff2" }],
variable: "--font-gtTrial",
});
export { gtRG , gtTrial}; // Exporting gtRG as a named export
STEP 3 :
import { gtRG , gtTrial } from "@/utils/coustomFonts";
<body className={`${gtRG.variable} ${gtTrial.variable}`}>{children}</body>
STEP 4 :
fontFamily : {
gtRG : ["var(--font-gtRG)"],
gtTrial: ["var(--font-gtTrial)"],
},
STEP 5 :
main.css
body {
@apply font-gtTrial;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment