geist-svelte
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGeist Svelte
Geist Svelte
Use this skill for integrating Geist fonts into Svelte and SvelteKit apps. Focus on app integration patterns, not library maintenance.
本技能用于在Svelte和SvelteKit应用中集成Geist字体。重点关注应用集成模式,而非库的维护。
When to Use This Skill
何时使用本技能
Use this skill when the user:
- Asks to add Geist fonts in a Svelte or SvelteKit project.
- Mentions Geist Sans, Geist Mono, or Geist Pixel variants.
- Needs help importing in root app/layout files.
geist-svelte/font/* - Wants Tailwind v4 () or Tailwind v3 (
@theme) setup for Geist variables.theme.extend.fontFamily - Wants to apply Geist fonts without Tailwind using .
var(--font-geist-*) - Needs troubleshooting for fonts not loading or not applying.
- Wants to migrate from manual/local Geist setup to
@font-face.geist-svelte
当用户有以下需求时,可使用本技能:
- 要求在Svelte或SvelteKit项目中添加Geist字体
- 提及Geist Sans、Geist Mono或Geist Pixel字体变体
- 需要帮助在根应用/布局文件中导入
geist-svelte/font/* - 希望为Geist变量配置Tailwind v4()或Tailwind v3(
@theme)theme.extend.fontFamily - 希望不使用Tailwind,通过来应用Geist字体
var(--font-geist-*) - 需要解决字体未加载或未生效的问题
- 想要从手动/本地的Geist字体设置迁移到
@font-facegeist-svelte
Workflow
操作流程
- Identify runtime and styling path.
- SvelteKit or Svelte (Vite).
- Tailwind v4, Tailwind v3, or no Tailwind.
- Decide whether the user needs Sans/Mono only or Pixel variants too.
- Install and import fonts at app entry/root.
- Install with package manager: (or
pnpm add geist-svelte/npm i).yarn add - Import font modules as side effects in the root layout/bootstrap file.
- Keep imports in root entry so CSS variables are registered globally.
- Map variables to the app styling system.
- Tailwind v4: map in in global CSS.
@theme inline - Tailwind v3: map in .
theme.extend.fontFamily - No Tailwind: use in global CSS rules.
var(--font-geist-*)
- Apply fonts intentionally.
- Use /
font-sans(Tailwind) or explicit CSSfont-mono.font-family - For Pixel, use specific variables () for display-only UI text.
--font-geist-pixel-* - Use named imports only when metadata (,
.variable) is needed..style.fontFamily
- Troubleshoot quickly.
- Verify root side-effect imports exist and load before UI render.
- Verify Tailwind theme mapping matches the CSS variable names.
- If lint flags unused imports, use side-effect import style ().
import 'geist-svelte/font/sans'
- 确定运行环境和样式方案
- SvelteKit或Svelte(Vite)
- Tailwind v4、Tailwind v3或不使用Tailwind
- 判断用户是否只需要Sans/Mono变体,还是也需要Pixel变体
- 在应用入口/根目录安装并导入字体
- 使用包管理器安装:(或
pnpm add geist-svelte/npm i)yarn add - 在根布局/引导文件中以副作用方式导入字体模块
- 将导入语句放在根入口文件中,确保CSS变量全局注册
- 将变量映射到应用样式系统
- Tailwind v4:在全局CSS的中进行映射
@theme inline - Tailwind v3:在中进行映射
theme.extend.fontFamily - 不使用Tailwind:在全局CSS规则中使用
var(--font-geist-*)
- 按需应用字体
- 使用/
font-sans(Tailwind)或显式的CSSfont-monofont-family - 对于Pixel变体,使用特定变量()仅用于展示类UI文本
--font-geist-pixel-* - 仅当需要元数据(、
.variable)时,才使用命名导入.style.fontFamily
- 快速排查问题
- 确认根入口的副作用导入语句存在,且在UI渲染前加载
- 确认Tailwind主题映射与CSS变量名称一致
- 如果代码检查工具标记未使用的导入,请使用副作用导入方式()
import 'geist-svelte/font/sans'
Guardrails
注意事项
- Do not suggest editing or
node_modulespackage internals.geist-svelte - Do not use remote/CDN runtime imports for fonts when package imports are available.
- Keep import paths to documented exports only:
geist-svelte/font/sansgeist-svelte/font/monogeist-svelte/font/pixelgeist-svelte/font/sans-non-variablegeist-svelte/font/mono-non-variable
- Prefer variable fonts first; use non-variable variants only for compatibility constraints.
- 请勿建议修改或
node_modules包的内部文件geist-svelte - 当可以通过包导入字体时,请勿使用远程/CDN运行时导入
- 仅使用文档中记录的导出路径:
geist-svelte/font/sansgeist-svelte/font/monogeist-svelte/font/pixelgeist-svelte/font/sans-non-variablegeist-svelte/font/mono-non-variable
- 优先使用可变字体;仅在存在兼容性限制时,才使用非可变字体变体
References
参考资料
references/quickstart.mdreferences/usage-patterns.mdreferences/troubleshooting.md
references/quickstart.mdreferences/usage-patterns.mdreferences/troubleshooting.md