Closed nekochan0122 closed 4 months ago
I just found the solution from ur repo 🤣
import { createRequire } from 'node:module'
import { pathToFileURL } from 'node:url'
const require = createRequire(import.meta.url)
// this is the url from node_modules
const jetbrainMono = String(pathToFileURL(require.resolve('@fontsource-variable/jetbrains-mono')))
but how to load multiple css urls?
I just released version 2.2.0, which supports passing an iterable of CSS URLs.
import { createRequire } from 'node:module' import { pathToFileURL } from 'node:url' const require = createRequire(import.meta.url) // this is the url from node_modules const jetbrainMono = String(pathToFileURL(require.resolve('@fontsource-variable/jetbrains-mono')))
Note that `mermaid-isomorphic converts URL objects to string. Your code is fine, but you can omit the string casting if you want.
import { createRequire } from 'node:module'
import { pathToFileURL } from 'node:url'
const require = createRequire(import.meta.url)
const jetbrainMono = pathToFileURL(require.resolve('@fontsource-variable/jetbrains-mono'))
I just released version 2.2.0, which supports passing an iterable of CSS URLs.
Hello, I got another issues in 2.2.0
, it will show this error when u pass 2 CSS URLs, but 1 is is ok:
Im pretty sure the URLs are correct, cuz I tried to put them 1 by 1 ( If A / B only, the libiray works).
I’m not sure what caused this, but I fixed it in version 2.2.1.
Im using fontsource to load the fonts in my Next.js app:
The css option only allow me to use url and what if I want to use mutiple fonts (for other language), how do I load them.