静态网站如何运作?
How does a static site works?
我正在努力了解这个新的静态站点生成器范例。它具体是如何工作的?
假设我有一个博客,我使用 Nextjs 或 Gatsby 生成静态页面:
- 是否为每个博客创建一个新页面post?
- 当我发布新的 post 时,我是否需要重新构建它?如果是这样,是否有某种例程不时执行此操作?
我可以替盖茨比回答这个问题。我敢肯定这里的人比我更了解 Gatsby,但这里是。
- "Does it create a new page for every blog post?"
Gatsby 将静态呈现它可以呈现的任何内容。这意味着一些静态呈现的 HTML,例如博客文章的集合和 React 组件。来自 Gatsby 主页:
Gatsby.js is a static PWA (Progressive Web App) generator. You get code and data splitting out-of-the-box. Gatsby loads only the critical HTML, CSS, data, and JavaScript so your site loads as fast as possible. Once loaded, Gatsby prefetches resources for other pages so clicking around the site feels incredibly fast.
- "As I publish new posts, do I need to build it all over again? If so, is there some kind of routine that does this from time to time?"
构建步骤,例如 gatsby build
,将是任何标准部署过程的一部分。在开发中,这些静态页面通过热重载在保存时重建。
我正在努力了解这个新的静态站点生成器范例。它具体是如何工作的?
假设我有一个博客,我使用 Nextjs 或 Gatsby 生成静态页面:
- 是否为每个博客创建一个新页面post?
- 当我发布新的 post 时,我是否需要重新构建它?如果是这样,是否有某种例程不时执行此操作?
我可以替盖茨比回答这个问题。我敢肯定这里的人比我更了解 Gatsby,但这里是。
- "Does it create a new page for every blog post?"
Gatsby 将静态呈现它可以呈现的任何内容。这意味着一些静态呈现的 HTML,例如博客文章的集合和 React 组件。来自 Gatsby 主页:
Gatsby.js is a static PWA (Progressive Web App) generator. You get code and data splitting out-of-the-box. Gatsby loads only the critical HTML, CSS, data, and JavaScript so your site loads as fast as possible. Once loaded, Gatsby prefetches resources for other pages so clicking around the site feels incredibly fast.
- "As I publish new posts, do I need to build it all over again? If so, is there some kind of routine that does this from time to time?"
构建步骤,例如 gatsby build
,将是任何标准部署过程的一部分。在开发中,这些静态页面通过热重载在保存时重建。