diff --git a/.gitignore b/.gitignore index 97b62797..a974b91e 100644 --- a/.gitignore +++ b/.gitignore @@ -40,3 +40,6 @@ next-env.d.ts # Sentry Config File .env.sentry-build-plugin + +# prepare fonts programmatically +app/fonts/index.ts diff --git a/app/fonts/Rosart-Bold.woff2 b/app/fonts/.gitkeep similarity index 100% rename from app/fonts/Rosart-Bold.woff2 rename to app/fonts/.gitkeep diff --git a/app/fonts/Rosart-Medium.woff2 b/app/fonts/Rosart-Medium.woff2 deleted file mode 100644 index e69de29b..00000000 diff --git a/app/fonts/Rosart-Regular.woff2 b/app/fonts/Rosart-Regular.woff2 deleted file mode 100644 index e69de29b..00000000 diff --git a/app/fonts/Rosart-RegularItalic.woff2 b/app/fonts/Rosart-RegularItalic.woff2 deleted file mode 100644 index e69de29b..00000000 diff --git a/app/fonts/Rosart-SemiBold.woff2 b/app/fonts/Rosart-SemiBold.woff2 deleted file mode 100644 index e69de29b..00000000 diff --git a/package.json b/package.json index 21336230..03ae41a0 100644 --- a/package.json +++ b/package.json @@ -3,8 +3,9 @@ "version": "0.1.0", "private": true, "scripts": { + "predev": "node prepare-font.js", "dev": "SENTRY_SUPPRESS_TURBOPACK_WARNING=1 next dev --turbo", - "prebuild": "node download-assets.js", + "prebuild": "node prepare-font.js", "build": "next build", "start": "next start", "lint": "next lint" diff --git a/download-assets.js b/prepare-font.js similarity index 84% rename from download-assets.js rename to prepare-font.js index 7573b67e..ed7d70ff 100644 --- a/download-assets.js +++ b/prepare-font.js @@ -35,6 +35,7 @@ const downloadFile = async (url, destination) => { url: `${BLOB_URL}/fonts/${fileName}.woff2`, destination: `./app/fonts/${fileName}.woff2`, })); + fs.copyFile("./vendor/fonts/rosert.ts", "./app/fonts/index.ts"); for (const file of filesToDownload) { try { @@ -45,6 +46,7 @@ const downloadFile = async (url, destination) => { } } } else { - console.log("Skipping download in non-production environment"); + fs.copyFile("./vendor/fonts/alternative.ts", "./app/fonts/index.ts"); + console.log("Using an alternative font file in development mode."); } })(); diff --git a/vendor/fonts/alternative.ts b/vendor/fonts/alternative.ts new file mode 100644 index 00000000..a3bc9ad6 --- /dev/null +++ b/vendor/fonts/alternative.ts @@ -0,0 +1,8 @@ +import { Roboto_Serif } from "next/font/google"; +/** + * Since the Rosart font is a proprietary font, use an alternative font during OSS development. + */ +export const rosart = Roboto_Serif({ + variable: "--font-rosart", + subsets: ["latin"], +}); diff --git a/app/fonts/index.ts b/vendor/fonts/rosart.ts similarity index 100% rename from app/fonts/index.ts rename to vendor/fonts/rosart.ts