Skip to main content

模板现在是独立的常规 Strapi 应用

¥Templates are now standalone, regular Strapi applications

模板已在 Strapi 5 中完全重写,现在是独立的常规 Strapi 应用,使创建、分发和重用它们变得更加容易。

此页面是 重大变更数据库 的一部分,提供有关重大更改的信息以及从 Strapi v4 迁移到 Strapi 5 的其他说明。

¥This page is part of the breaking changes database and provides information about the breaking change and additional instructions to migrate from Strapi v4 to Strapi 5.

\🔌 此重大更改是否会影响插件?\
\🤖 此重大更改是否由 codemod 自动处理?\

¥Templates have been fully rewritten in Strapi 5 and now are standalone, regular Strapi applications, making it easier to create, distribute, and reuse them.

此页面是 重大变更数据库 的一部分,提供有关重大更改的信息以及从 Strapi v4 迁移到 Strapi 5 的其他说明。

¥This page is part of the breaking changes database and provides information about the breaking change and additional instructions to migrate from Strapi v4 to Strapi 5.

\🔌 此重大更改是否会影响插件?\
\🤖 此重大更改是否由 codemod 自动处理?\

重大更改描述

¥Breaking change description

在 Strapi v4 中

¥In Strapi v4

模板是具有严格要求的 npm 包(参见 v4 文档)。

¥Templates were npm packages with strict requirements (see v4 documentation).

在 Strapi 5 中

¥In Strapi 5

模板现在只是常规的 Strapi 5 应用,可以单独运行。

¥Templates are now just regular Strapi 5 applications, which can be run on their own.

迁移

¥Migration

本节重新组合了有关引入的重大更改的有用说明和程序。

¥This section regroups useful notes and procedures about the introduced breaking change.

注意

¥Notes

  • 有关基于现有模板创建新的 Strapi 应用的更多信息,请参阅 模板文档

    ¥For additional information about creating a new Strapi application based on an existing template, see the templates documentation.

  • 创建 Strapi 模板现在就像创建一个新的 Strapi 5 应用并根据你的需要调整其代码库一样简单。

    ¥Creating a Strapi template is now as simple as creating a new Strapi 5 application and adjusting its codebase to your needs.

手动迁移

¥Manual migration

Strapi v4 中的模板仅在默认 Strapi 应用之上应用时才有用。Strapi 5 模板现在是独立的 Strapi 5 应用。

¥Templates in Strapi v4 were only useful if applied on top of a default Strapi application. Strapi 5 templates are now standalone Strapi 5 applications.

要将你的 Strapi v4 模板转换为可用的 Strapi 5 模板,请确保模板包含 Strapi 运行所需的所有文件。你的文件夹包含应用于完整 Strapi 应用之上的 v4 模板,足以成为 Strapi 5 模板。

¥To convert your Strapi v4 template into a usable Strapi 5 template, ensure the template includes all files required for Strapi to work. Your folder containing the v4 template applied on top of a full-blown Strapi application should be enough to be a Strapi 5 template.