Fontsource
Self-host Open Source fonts in neatly bundled NPM packages.
Install the Package
Variable Fonts
참고로 Variable Font 는 다음과 같이 설치:
Import the Font
In your application’s entry file, page, or site component, import the font package using the package name. For example, to import Open Sans into index.jsx, add the following code:
Weights and Styles
If you only need specific font weights or styles, you can import them individually to reduce the payload size. Fontsource allows you to select weights and styles precisely. To import a specific weight or style, use the corresponding imports. For example:
import "@fontsource/open-sans/500.css"; // Weight 500.
import "@fontsource/open-sans/900-italic.css"; // Italic variant.
CSS
Once the font is imported, you can reference it in your CSS stylesheets, CSS Modules, or CSS-in-JS. Use the font family name associated with the font package you installed. For example:
See also
- fontsource
- font-files - 폰트 파일들
- font
- npm
- google-font