fix: switch Google Fonts to runtime <link> tags for build environments without internet
- Replace next/font/google with <link> tags in <head> (loads fonts client-side at runtime) - Define --font-nunito and --font-pixel CSS variables in globals.css with font-family fallbacks - Remove @prisma/client from serverExternalPackages in next.config.ts (devDep only)
This commit is contained in:
1 parent
9a8905c726
commit
2f030deb42
3 files changed
+16
-18
No files matched your search
@@ -4,6 +4,11 @@
|
||||
@plugin "tailwindcss-animate";
|
||||
@custom-variant dark (&:where(.dark, .dark *));
|
||||
|
||||
:root {
|
||||
--font-nunito: "Nunito", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
|
||||
--font-pixel: "Pixelify Sans", monospace;
|
||||
}
|
||||
|
||||
@theme {
|
||||
--font-sans:
|
||||
var(--font-nunito), "Nunito", ui-sans-serif, system-ui, -apple-system,
|
||||
|
||||
+11
-16
@@ -1,5 +1,4 @@
|
||||
import type { Metadata } from "next";
|
||||
import { Nunito, Pixelify_Sans } from "next/font/google";
|
||||
import { headers } from "next/headers";
|
||||
import Script from "next/script";
|
||||
import { NextIntlClientProvider } from "next-intl";
|
||||
@@ -15,20 +14,6 @@ import { resolveHotelName } from "@/lib/hotel-name";
|
||||
import { siteSettings } from "@/lib/services/site-settings";
|
||||
import "./globals.css";
|
||||
|
||||
const nunito = Nunito({
|
||||
subsets: ["latin"],
|
||||
weight: ["400", "600", "700", "800"],
|
||||
display: "swap",
|
||||
variable: "--font-nunito",
|
||||
});
|
||||
|
||||
const pixelFont = Pixelify_Sans({
|
||||
subsets: ["latin"],
|
||||
weight: ["400", "700"],
|
||||
display: "swap",
|
||||
variable: "--font-pixel",
|
||||
});
|
||||
|
||||
export async function generateMetadata(): Promise<Metadata> {
|
||||
const appUrl = process.env.APP_URL ?? "http://localhost:3000";
|
||||
const hotel = await resolveHotelName();
|
||||
@@ -69,10 +54,20 @@ export default async function RootLayout({
|
||||
return (
|
||||
<html
|
||||
lang={locale}
|
||||
className={`app ${nunito.variable} ${pixelFont.variable}`}
|
||||
className="app"
|
||||
>
|
||||
<head>
|
||||
<meta name="theme-default-dark" content={String(defaultDark)} />
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossOrigin="anonymous" />
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800&display=swap"
|
||||
/>
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="https://fonts.googleapis.com/css2?family=Pixelify+Sans:wght@400;700&display=swap"
|
||||
/>
|
||||
<Script
|
||||
src="/scripts/theme-init.js"
|
||||
strategy="beforeInteractive"
|
||||
|
||||
Reference in new issue
Block a user