Skip to content

Commit 2039bdc

Browse files
feat(web): Use local fonts in Next.js app to improve build times (#626)
* feat(web): Use local fonts in Next.js app to improve build times Switches from using `next/font/google` to `next/font/local` for all fonts used in the `apps/web` Next.js application. This change involves: - Downloading all previously used Google Fonts (WOFF2 format) and storing them locally in `apps/web/public/fonts/`. - Updating `apps/web/lib/fonts.ts` to define fonts using `next/font/local`, pointing to the locally stored font files. - Modifying `apps/web/app/layout.tsx` to utilize the locally defined `Inter` font from `lib/fonts.ts`. - Verifying that the existing Docker configuration (`services/app/Dockerfile`) correctly includes the `apps/web/public/fonts/` directory in the final image. This approach aims to reduce build times by avoiding font downloads during the build process and bundles the fonts directly with the application. * Fixed fonts --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
1 parent 80bd7d2 commit 2039bdc

File tree

47 files changed

+266
-92
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+266
-92
lines changed

apps/web/app/layout.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,8 @@ import {
1212
} from "@ui-lib/utils";
1313
import * as fonts from "@/lib/fonts";
1414
import { generateThemeStyles } from "@/lib/theme-styles";
15-
import { Inter } from "next/font/google";
1615
import { SITE_SETTINGS_DEFAULT_TITLE } from "@ui-config/strings";
1716

18-
const inter = Inter({ subsets: ["latin"] });
19-
2017
export async function generateMetadata(): Promise<Metadata> {
2118
const address = getAddressFromHeaders(headers);
2219
const siteInfo = await getSiteInfo(address);
@@ -66,7 +63,7 @@ export default async function RootLayout({ children }: RootLayoutProps) {
6663
<style>{themeStyles}</style>
6764
</head>
6865
<body
69-
className={`${fonts.openSans.variable} ${fonts.montserrat.variable} ${fonts.lato.variable} ${fonts.poppins.variable} ${fonts.sourceSans3.variable} ${fonts.raleway.variable} ${fonts.notoSans.variable} ${fonts.merriweather.variable} ${fonts.inter.variable} ${fonts.alegreya.variable} ${fonts.roboto.variable} ${fonts.mulish.variable} ${fonts.nunito.variable} ${fonts.rubik.variable} ${fonts.playfairDisplay.variable} ${fonts.oswald.variable} ${fonts.ptSans.variable} ${fonts.workSans.variable} ${fonts.robotoSlab.variable} ${fonts.sourceSerif4.variable} ${fonts.bebasNeue.variable} ${fonts.quicksand.variable} font-sans ${inter.className}`}
66+
className={`${fonts.openSans.variable} ${fonts.montserrat.variable} ${fonts.lato.variable} ${fonts.poppins.variable} ${fonts.sourceSans3.variable} ${fonts.raleway.variable} ${fonts.notoSans.variable} ${fonts.merriweather.variable} ${fonts.inter.variable} ${fonts.alegreya.variable} ${fonts.roboto.variable} ${fonts.mulish.variable} ${fonts.nunito.variable} ${fonts.rubik.variable} ${fonts.playfairDisplay.variable} ${fonts.oswald.variable} ${fonts.ptSans.variable} ${fonts.workSans.variable} ${fonts.robotoSlab.variable} ${fonts.sourceSerif4.variable} ${fonts.bebasNeue.variable} ${fonts.quicksand.variable} font-sans ${fonts.inter.className}`}
7067
>
7168
{children}
7269
</body>

0 commit comments

Comments
 (0)