Node.js: Difference between revisions
Malteneuss (talk | contribs) m Fix nix build --print-out-paths |
Malteneuss (talk | contribs) m Fix google font override |
||
Line 200: | Line 200: | ||
import localFont from "next/font/local"; | import localFont from "next/font/local"; | ||
const inter = localFont({ src: './Inter.ttf' }); | const inter = localFont({ src: './Inter.ttf' }); | ||
</syntaxhighlight>and place the Google fonts from Nixpkgs into the project, e.g. in a <code> | </syntaxhighlight>and place the Google fonts from Nixpkgs into the project, e.g. in a <code>preBuild</code> phase:<syntaxhighlight lang="nix"> | ||
buildNpmPackage { | buildNpmPackage { | ||
pname = "myproject"; | pname = "myproject"; | ||
Line 207: | Line 207: | ||
# see https://github.com/NixOS/nixpkgs/blob/master/pkgs/by-name/cr/crabfit-frontend/package.nix | # see https://github.com/NixOS/nixpkgs/blob/master/pkgs/by-name/cr/crabfit-frontend/package.nix | ||
preBuild = '' | |||
cp "${ | cp "${ | ||
google-fonts.override { fonts = [ "Inter" ]; } | google-fonts.override { fonts = [ "Inter" ]; } | ||
}/share/fonts/truetype/Inter[wght].ttf" src/app/Inter.ttf | }/share/fonts/truetype/Inter[slnt,wght].ttf" src/app/Inter.ttf | ||
''; | ''; | ||