比较按岛屿组织交互的 HTML 网站与 Gatsby 的 React 水合、source 插件数据管线。
gatsby 用于构建 React 网站,其数据层可通过 source 插件接入 CMS 等服务。构建时查询生成页面内容,React 也可在水合后于浏览器获取变化的数据。它适合已经使用 Gatsby 插件及页面生成约定的团队。仅浏览器可用的代码仍须兼顾构建阶段的服务端渲染。
astro 是面向内容网站的替代路线,生成 HTML,并按需水合交互组件。它能使用 React 组件,但不是 Gatsby 的直接替换品。迁移需要重新处理路由、数据查询、图片和插件集成,现有 Gatsby GraphQL 查询不会自动转移。应按内容管线和交互需求选择,不预设任一框架总是更快。
astro: 适合内容页面加按需交互岛屿;迁移时重做 Gatsby 数据查询及集成。
gatsby: 适合已有 React 页面、source 插件与构建查询的项目;构建时隔离浏览器专属代码。
适合内容页面加按需交互岛屿;迁移时重做 Gatsby 数据查询及集成。
适合已有 React 页面、source 插件与构建查询的项目;构建时隔离浏览器专属代码。
Astro is the all-in-one web framework designed for speed.
Pull your content from anywhere and deploy everywhere, all powered by your favorite UI components and libraries.
# Recommended!
npm create astro@latest
# Manual:
npm install astro
Looking for help? Start with our Getting Started guide.
Looking for quick examples? Open a starter project right in your browser.
Visit our official documentation.
Having trouble? Get help in the official Astro Discord.
New contributors welcome! Check out our Contributors Guide for help getting started.
Join us on Discord to meet other contributors. We'll help you get your first contribution in no time!
Astro is generously supported by Cloudflare, Mux, Netlify, Webflow, and several other amazing organizations.