Created
June 22, 2024 14:52
-
-
Save viibhuGupta/6dca95a78710ca03700bb7fe000a057d to your computer and use it in GitHub Desktop.
Font Setup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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