Pulled ALL skills from 15 source repositories: - anthropics/skills: 16 (docs, design, MCP, testing) - obra/superpowers: 14 (TDD, debugging, agents, planning) - coreyhaines31/marketingskills: 25 (marketing, CRO, SEO, growth) - better-auth/skills: 5 (auth patterns) - vercel-labs/agent-skills: 5 (React, design, Vercel) - antfu/skills: 16 (Vue, Vite, Vitest, pnpm, Turborepo) - Plus 13 individual skills from various repos Mosaic Stack is not limited to coding — the Orchestrator and subagents serve coding, business, design, marketing, writing, logistics, analysis, and more. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
72 lines
1.4 KiB
Markdown
72 lines
1.4 KiB
Markdown
---
|
|
title: Load fonts natively at build time
|
|
impact: LOW
|
|
impactDescription: fonts available at launch, no async loading
|
|
tags: fonts, expo, performance, config-plugin
|
|
---
|
|
|
|
## Use Expo Config Plugin for Font Loading
|
|
|
|
Use the `expo-font` config plugin to embed fonts at build time instead of
|
|
`useFonts` or `Font.loadAsync`. Embedded fonts are more efficient.
|
|
|
|
**Incorrect (async font loading):**
|
|
|
|
```tsx
|
|
import { useFonts } from 'expo-font'
|
|
import { Text, View } from 'react-native'
|
|
|
|
function App() {
|
|
const [fontsLoaded] = useFonts({
|
|
'Geist-Bold': require('./assets/fonts/Geist-Bold.otf'),
|
|
})
|
|
|
|
if (!fontsLoaded) {
|
|
return null
|
|
}
|
|
|
|
return (
|
|
<View>
|
|
<Text style={{ fontFamily: 'Geist-Bold' }}>Hello</Text>
|
|
</View>
|
|
)
|
|
}
|
|
```
|
|
|
|
**Correct (config plugin, fonts embedded at build):**
|
|
|
|
```json
|
|
// app.json
|
|
{
|
|
"expo": {
|
|
"plugins": [
|
|
[
|
|
"expo-font",
|
|
{
|
|
"fonts": ["./assets/fonts/Geist-Bold.otf"]
|
|
}
|
|
]
|
|
]
|
|
}
|
|
}
|
|
```
|
|
|
|
```tsx
|
|
import { Text, View } from 'react-native'
|
|
|
|
function App() {
|
|
// No loading state needed—font is already available
|
|
return (
|
|
<View>
|
|
<Text style={{ fontFamily: 'Geist-Bold' }}>Hello</Text>
|
|
</View>
|
|
)
|
|
}
|
|
```
|
|
|
|
After adding fonts to the config plugin, run `npx expo prebuild` and rebuild the
|
|
native app.
|
|
|
|
Reference:
|
|
[Expo Font Documentation](https://docs.expo.dev/versions/latest/sdk/font/)
|