Skip to content

Commit 67ed777

Browse files
committed
feat(core): add styles/fonts subpath export with fontsource
- Add @fontsource-variable/geist and @fontsource-variable/inter as deps - Add ./styles/fonts export in package.json pointing to dist/fonts.css - Create src/assets/fonts.css importing fontsource packages - Update globals.css font-axis comment to reference new subpath - Update examples to import @tailor-platform/app-shell/styles/fonts - Remove next/font/google usage in Next.js example in favor of fontsource
1 parent e1526eb commit 67ed777

7 files changed

Lines changed: 38 additions & 13 deletions

File tree

examples/nextjs-app/src/app/globals.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
@import "tailwindcss";
22
@import "tw-animate-css";
3+
@import "@tailor-platform/app-shell/styles";
4+
@import "@tailor-platform/app-shell/styles/fonts";
35

46
@custom-variant dark (&:is(.dark *));
57

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,8 @@
11
import type { Metadata } from "next";
2-
import { Geist, Geist_Mono } from "next/font/google";
32
import "@tailor-platform/app-shell/styles";
3+
import "@tailor-platform/app-shell/styles/fonts";
44
import "./globals.css";
55

6-
const geistSans = Geist({
7-
variable: "--font-geist-sans",
8-
subsets: ["latin"],
9-
});
10-
11-
const geistMono = Geist_Mono({
12-
variable: "--font-geist-mono",
13-
subsets: ["latin"],
14-
});
15-
166
export const metadata: Metadata = {
177
title: "Create Next App",
188
description: "Generated by create next app",
@@ -25,7 +15,7 @@ export default function RootLayout({
2515
}>) {
2616
return (
2717
<html lang="en" suppressHydrationWarning>
28-
<body className={`${geistSans.variable} ${geistMono.variable} antialiased`}>{children}</body>
18+
<body className="antialiased">{children}</body>
2919
</html>
3020
);
3121
}

examples/vite-app/src/index.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
@import "tailwindcss";
22
@import "@tailor-platform/app-shell/styles";
3+
@import "@tailor-platform/app-shell/styles/fonts";
34

45
html,
56
body {

packages/core/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"type": "module",
2929
"exports": {
3030
"./styles": "./dist/app-shell.css",
31+
"./styles/fonts": "./dist/fonts.css",
3132
"./theme.css": "./dist/theme.css",
3233
".": {
3334
"types": "./dist/app-shell.d.ts",
@@ -50,6 +51,8 @@
5051
},
5152
"dependencies": {
5253
"@base-ui/react": "^1.5.0",
54+
"@fontsource-variable/geist": "^5.0.0",
55+
"@fontsource-variable/inter": "^5.0.0",
5356
"@standard-schema/spec": "^1.1.0",
5457
"@tailor-platform/app-shell-vite-plugin": "workspace:*",
5558
"@tailor-platform/auth-public-client": "^0.5.0",

packages/core/src/assets/fonts.css

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/*
2+
* Self-hosted variable fonts used by AppShell's appearance axis. Shipped as a
3+
* separate, opt-in stylesheet via the `@tailor-platform/app-shell/styles/fonts`
4+
* subpath so the default `@import "@tailor-platform/app-shell/styles"` stays
5+
* font-free and consumers can choose their own loading strategy (e.g.
6+
* `next/font/local`, `next/font/google`, or a CDN).
7+
*
8+
* Family names: `"Geist Variable"`, `"Inter Variable"`. AppShell's
9+
* `globals.css` falls back to `"Geist Sans"` / `"Inter"` after these so
10+
* consumers who self-host with the conventional family names also work.
11+
*/
12+
@import "@fontsource-variable/geist";
13+
@import "@fontsource-variable/inter";

packages/core/src/globals.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
* Font axis — applied independently of color theme via `data-font` on `<html>`.
4040
*
4141
* Family-name chain prefers the variable build (loaded by
42-
* `@tailor-platform/app-shell/fonts`), then the conventional static family
42+
* `@tailor-platform/app-shell/styles/fonts`), then the conventional static family
4343
* name (`Geist Sans` / `Inter` — what `next/font/google` and most CDNs
4444
* register), then the system stack. Consumers who load their own font under
4545
* either name automatically participate; no font loads when nothing matches.

pnpm-lock.yaml

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)