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
@@ -22,9 +22,7 @@ const securityHeaders = [
|
|||||||
const nextConfig: NextConfig = {
|
const nextConfig: NextConfig = {
|
||||||
turbopack: {},
|
turbopack: {},
|
||||||
serverExternalPackages: [
|
serverExternalPackages: [
|
||||||
"@prisma/adapter-mariadb",
|
|
||||||
"mariadb",
|
"mariadb",
|
||||||
"@prisma/client",
|
|
||||||
"lzma",
|
"lzma",
|
||||||
"sharp",
|
"sharp",
|
||||||
"pino",
|
"pino",
|
||||||
|
|||||||
@@ -4,6 +4,11 @@
|
|||||||
@plugin "tailwindcss-animate";
|
@plugin "tailwindcss-animate";
|
||||||
@custom-variant dark (&:where(.dark, .dark *));
|
@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 {
|
@theme {
|
||||||
--font-sans:
|
--font-sans:
|
||||||
var(--font-nunito), "Nunito", ui-sans-serif, system-ui, -apple-system,
|
var(--font-nunito), "Nunito", ui-sans-serif, system-ui, -apple-system,
|
||||||
|
|||||||
+11
-16
@@ -1,5 +1,4 @@
|
|||||||
import type { Metadata } from "next";
|
import type { Metadata } from "next";
|
||||||
import { Nunito, Pixelify_Sans } from "next/font/google";
|
|
||||||
import { headers } from "next/headers";
|
import { headers } from "next/headers";
|
||||||
import Script from "next/script";
|
import Script from "next/script";
|
||||||
import { NextIntlClientProvider } from "next-intl";
|
import { NextIntlClientProvider } from "next-intl";
|
||||||
@@ -15,20 +14,6 @@ import { resolveHotelName } from "@/lib/hotel-name";
|
|||||||
import { siteSettings } from "@/lib/services/site-settings";
|
import { siteSettings } from "@/lib/services/site-settings";
|
||||||
import "./globals.css";
|
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> {
|
export async function generateMetadata(): Promise<Metadata> {
|
||||||
const appUrl = process.env.APP_URL ?? "http://localhost:3000";
|
const appUrl = process.env.APP_URL ?? "http://localhost:3000";
|
||||||
const hotel = await resolveHotelName();
|
const hotel = await resolveHotelName();
|
||||||
@@ -69,10 +54,20 @@ export default async function RootLayout({
|
|||||||
return (
|
return (
|
||||||
<html
|
<html
|
||||||
lang={locale}
|
lang={locale}
|
||||||
className={`app ${nunito.variable} ${pixelFont.variable}`}
|
className="app"
|
||||||
>
|
>
|
||||||
<head>
|
<head>
|
||||||
<meta name="theme-default-dark" content={String(defaultDark)} />
|
<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
|
<Script
|
||||||
src="/scripts/theme-init.js"
|
src="/scripts/theme-init.js"
|
||||||
strategy="beforeInteractive"
|
strategy="beforeInteractive"
|
||||||
|
|||||||
Reference in new issue
Block a user