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 git fetch kustomize error
    MicroK8s git fetch kustomize errorThis is a simple workaround when you get a git fetch error when trying deploy kustomize on MicroK8s
  • cs | en