.skills/static-site-generator/SKILL.md
--- name: static-site-generator description: Framework-exclusive skill for Gravito SSG (Freeze Protocol). Operates directly on PlanetCore and Orbit systems. Use when user asks to: (1) Create static site with gravito create --template static-site, (2) Configure Freeze/SSG settings, (3) Fix StaticLink navigation issues, (4) Generate sitemap via OrbitConstellation, (5) Deploy to GitHub Pages/Vercel, (6) Debug deployment issues (404, empty pages, asset loading failures, MIME type errors), (7) Troubl
npx skillsauth add gravito-framework/gravito .skills/static-site-generatorInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Gravito 框架專用的靜態網站生成器。NOT a general-purpose SSG tool.
| 套件 | 用途 |
|------|------|
| @gravito/freeze | SSG 核心模組 |
| @gravito/freeze-react | React StaticLink + useFreeze hook |
| @gravito/freeze-vue | Vue StaticLink + useFreeze composable |
| @gravito/prism | 視圖引擎 + StaticSiteGenerator (packages/prism/src/SSG.ts) |
| @gravito/constellation | Sitemap 生成 + 重定向管理 |
Generator boots headless PlanetCore instance,確保每個頁面經過:
Static Generation = Freezing。透過 core.adapter.fetch 進行內部請求分派。
# 1. Scaffold
gravito create my-site --template static-site --framework react # or vue
# 2. Develop
bun run dev
# 3. Freeze (Build)
bun run build:static
# 4. Preview
bun run preview:static
NEVER use <Link> from Inertia for static routes. Use official packages:
// React - from @gravito/freeze-react
import { StaticLink, useFreeze } from '@gravito/freeze-react'
<StaticLink href="/about">About</StaticLink>
// Vue - from @gravito/freeze-vue
import { StaticLink, useFreeze } from '@gravito/freeze-vue'
<StaticLink href="/about">About</StaticLink>
Features:
getLocalizedPath)skipLocalization prop 可跳過可在 src/hooks/index.ts 定義,generate.ts 會自動調用:
// HTML 後處理(generate.ts 自動調用)
core.hooks.addFilter('ssg:rendered', async (html: string) => {
return minify(html)
})
詳見 references/configuration.md
開發環境常見問題:
| 症狀 | 可能原因 | |------|---------| | 前端資源 404 | Vite proxy 未正確設置,或 bootstrap 順序錯誤 | | CSS MIME type 錯誤 | 強制覆蓋了 Vite 的 Content-Type | | 端口衝突 | 舊進程佔用端口 |
關鍵原則:
setupViteProxy 必須在 registerRoutes 之前調用app.use('*', ...) 而非 app.all('*', ...)詳見 references/dev-troubleshooting.md
*View.vue / *View.tsx to avoid naming collisions404.html with recovery script for deep-linksbun run preview:static 確認:
/static/build/ 載入404.html 存在於 root| Script | Purpose |
|--------|---------|
| scripts/generate.ts | 完整 SSG 生成腳本(可複製到專案使用) |
| scripts/verify.ts | 驗證構建輸出是否符合預期 |
功能完整的 SSG 腳本,包含:
core.adapter.fetch使用方式:
BOOTSTRAP_PATH 和 KNOWN_ROUTESbun run generate.ts或直接使用官方 bun run build:static
需要配置檔(預設 ssg.verify.json):
{
"outDir": "dist-static",
"checks": [
{ "file": "index.html", "contains": ["<!DOCTYPE html>"] },
{ "file": "404.html", "contains": ["SPA routing"] }
]
}
development
Specialized in frontend development with Zenith, Vue 3, and Inertia.js. Trigger this for UI components, page layouts, and styling.
testing
Specialized in testing and quality assurance for Gravito. Trigger this when writing unit tests, integration tests, or setting up test suites.
data-ai
Expert in Gravito Satellite modules. Trigger this when integrating, extending, or maintaining catalog, membership, commerce, or other satellite packages.
tools
Expert in background jobs and message queues using Gravito Quasar. Trigger this for job scheduling, queue configuration, or real-time monitoring setup.