Skip to content

Commit

Permalink
clean up next fonts
Browse files Browse the repository at this point in the history
  • Loading branch information
jakejarvis committed Oct 30, 2022
1 parent 6520e6f commit b58a138
Show file tree
Hide file tree
Showing 7 changed files with 210 additions and 210 deletions.
16 changes: 3 additions & 13 deletions lib/styles/stitches.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,7 @@ import hexToRgba from "./utils/hex-to-rgba";
import normalizeStyles from "./utils/normalize";

// web fonts
import { Inter, Roboto_Mono } from "@next/font/google";
export const inter = Inter({
weight: "variable",
display: "fallback",
preload: true,
});
export const robotoMono = Roboto_Mono({
weight: "variable",
display: "fallback",
preload: true,
});
import { Inter, RobotoMono } from "./utils/fonts";

// https://stitches.dev/docs/typescript#type-a-css-object
export type CSS = Stitches.CSS<typeof stitchesConfig>;
Expand All @@ -33,8 +23,8 @@ export const {
} = createStitches({
theme: {
fonts: {
sans: `${inter.style.fontFamily}, sans-serif`,
mono: `${robotoMono.style.fontFamily}, monospace`,
sans: `${Inter.style.fontFamily}, sans-serif`,
mono: `${RobotoMono.style.fontFamily}, monospace`,
},

colors: {
Expand Down
30 changes: 30 additions & 0 deletions lib/styles/utils/fonts.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import {
Inter as InterLoader,
Roboto_Mono as RobotoMonoLoader,
Comic_Neue as ComicNeueLoader,
} from "@next/font/google";

// note: subsets are set to 'latin' globally in next.config.js
// https://beta.nextjs.org/docs/optimizing/fonts#specifying-a-subset

export const Inter = InterLoader({
weight: "variable",
display: "fallback",
preload: true,
});

export const RobotoMono = RobotoMonoLoader({
weight: "variable",
display: "fallback",
preload: true,
});

// only for use in pages/previously.tsx (and tree-shaken out everywhere else in production)
export const ComicNeue = ComicNeueLoader({
weight: ["400", "700"],
style: ["normal", "italic"],
display: "swap",
fallback: ["'Comic Sans MS'", "'Comic Sans'"],
adjustFontFallback: false,
preload: false,
});
Loading

1 comment on commit b58a138

@vercel
Copy link

@vercel vercel bot commented on b58a138 Oct 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

jarvis – ./

jarvis-git-main-jakejarvis.vercel.app
jarvis-jakejarvis.vercel.app
jarv.is
www.jarv.is

Please sign in to comment.