Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion website/docs/en/config/html/favicon.mdx
Original file line number Diff line number Diff line change
@@ -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:

Expand All @@ -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:
Expand Down Expand Up @@ -105,3 +115,9 @@ export default {
},
};
```

## Version history

| Version | Changes |
| ------- | ----------------------------------------------------------- |
| v1.6.0 | Added automatic favicon detection from the public directory |
18 changes: 17 additions & 1 deletion website/docs/zh/config/html/favicon.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# html.favicon

- **类型:** `string | Function`
- **默认值:** `undefined`
- **默认值:** 自动读取 public 目录下的 favicon 文件

设置页面的 favicon 图标,可以设置为:

Expand All @@ -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`

## 示例

设置为相对路径:
Expand Down Expand Up @@ -105,3 +115,9 @@ export default {
},
};
```

## 版本历史

| 版本 | 变更内容 |
| ------ | ----------------------------------------- |
| v1.6.0 | 新增自动检测 public 目录下的 favicon 文件 |
Loading