diff --git a/website/docs/en/config/html/favicon.mdx b/website/docs/en/config/html/favicon.mdx index ebdbaba5e1..06352fdcf8 100644 --- a/website/docs/en/config/html/favicon.mdx +++ b/website/docs/en/config/html/favicon.mdx @@ -1,7 +1,7 @@ # html.favicon - **Type:** `string | Function` -- **Default:** `undefined` +- **Default:** Automatically detects favicon files in the `public` directory Set the favicon icon path for all pages, can be set as: @@ -15,6 +15,16 @@ After config this option, the favicon will be automatically copied to the dist d Rsbuild also provides [html.appIcon](/config/html/app-icon) to set the icon of the web application. ::: +## Default value + +When `html.favicon` is not explicitly configured, Rsbuild will automatically look for favicon files in the [public directory](/config/server/public-dir). + +It searches for the following files in order, and uses the first one it finds as the default favicon: + +- `public/favicon.ico` +- `public/favicon.png` +- `public/favicon.svg` + ## Example Set as a relative path: @@ -105,3 +115,9 @@ export default { }, }; ``` + +## Version history + +| Version | Changes | +| ------- | ----------------------------------------------------------- | +| v1.6.0 | Added automatic favicon detection from the public directory | diff --git a/website/docs/zh/config/html/favicon.mdx b/website/docs/zh/config/html/favicon.mdx index 4fbd10ef43..43dcae1007 100644 --- a/website/docs/zh/config/html/favicon.mdx +++ b/website/docs/zh/config/html/favicon.mdx @@ -1,7 +1,7 @@ # html.favicon - **类型:** `string | Function` -- **默认值:** `undefined` +- **默认值:** 自动读取 public 目录下的 favicon 文件 设置页面的 favicon 图标,可以设置为: @@ -15,6 +15,16 @@ Rsbuild 还提供了 [html.appIcon](/config/html/app-icon) 来设置 Web 应用的图标。 ::: +## 默认值 + +在未显式配置 `html.favicon` 时, Rsbuild 会自动从 [public 目录](/config/server/public-dir) 中查找 favicon 文件。 + +Rsbuild 会按以下优先级依次搜索文件,并在找到第一个匹配项后将其作为默认 favicon: + +- `public/favicon.ico` +- `public/favicon.png` +- `public/favicon.svg` + ## 示例 设置为相对路径: @@ -105,3 +115,9 @@ export default { }, }; ``` + +## 版本历史 + +| 版本 | 变更内容 | +| ------ | ----------------------------------------- | +| v1.6.0 | 新增自动检测 public 目录下的 favicon 文件 |