Martin Koníček

Blog

NextJS - global font with css style module

Showcase image

I was wondering, how to set-up global font module using css style module in NextJS, here is how.

layout.tsx

import { Poppins } from 'next/font/google';

const poppins = Poppins({
  weight: ['700'],
  subsets: ['latin'],
  variable: '--poppins-font',
});

export default function RootLayout({
...
  return (
    <html lang="en">
      <body className={`myclasses ${poppins.variable}`}>
...

page.tsx

import styles from './styles.module.css'

style.module.css

.menu {
  font-family: var(--poppins-font),sans-serif;
}
  • MicroK8S failing with Kustomize
    MicroK8S failing with KustomizeWhen you get an error message error: failed to run '/snap/microk8s/5250/usr/bin/git fetch --depth=1 https://... main': fatal: couldn't find remote ref main this might be a solution
  • cs | en