diff --git a/website/docs/en/config/output/css-modules.mdx b/website/docs/en/config/output/css-modules.mdx index 5de25fb633..1e2e30ffac 100644 --- a/website/docs/en/config/output/css-modules.mdx +++ b/website/docs/en/config/output/css-modules.mdx @@ -201,9 +201,9 @@ import styles from './index.module.scss'; console.log(styles.header); ``` -### Template string +### Placeholders -You can use the following template strings in `localIdentName`: +You can use the following placeholders in `localIdentName`: - `[name]` - the basename of the asset. - `[local]` - original class. diff --git a/website/docs/en/config/output/filename.mdx b/website/docs/en/config/output/filename.mdx index fd5e09c5c5..3b8ee132fb 100644 --- a/website/docs/en/config/output/filename.mdx +++ b/website/docs/en/config/output/filename.mdx @@ -107,22 +107,22 @@ Typically, Rsbuild only sets the filename hash in production mode (`process.env. Setting the filename hash in development mode may cause HMR to fail (especially for CSS files). This happens because each time the file content changes, the hash value changes, preventing the bundler from reading the latest file content. ::: -## Template strings +## Filename placeholders -In `output.filename`, you can use template strings to dynamically generate file names. +In `output.filename`, you can use filename placeholders to dynamically generate file names. -Common template strings include: +Common filename placeholders include: - `[name]` - entry name, which is the key of [source.entry](/config/source/entry). - `[contenthash]` - hash value generated based on file content. - `[contenthash:]` - hash value generated based on file content, with specified hash length. - `[ext]` - file extension, including the dot. -> For more template strings, refer to [Rspack - Template String](https://rspack.rs/config/output#template-string). +> For more filename placeholders, refer to [Rspack - Filename placeholders](https://rspack.rs/config/filename-placeholders). :::tip -- `filename.html` can only use certain template strings like `[name]` and `[contenthash:]`. +- `filename.html` can only use certain filename placeholders like `[name]` and `[contenthash:]`. - `filename.js` and `filename.css` do not support `[ext]`. ::: diff --git a/website/docs/zh/config/output/css-modules.mdx b/website/docs/zh/config/output/css-modules.mdx index 0c20b09f99..2d7dc83955 100644 --- a/website/docs/zh/config/output/css-modules.mdx +++ b/website/docs/zh/config/output/css-modules.mdx @@ -201,9 +201,9 @@ import styles from './index.module.scss'; console.log(styles.header); ``` -### 模板字符串 +### 占位符 -在 `localIdentName` 中,你可以使用以下模板字符串: +在 `localIdentName` 中,你可以使用以下占位符: - `[name]` - 源文件名称。 - `[local]` - 原始类名。 diff --git a/website/docs/zh/config/output/filename.mdx b/website/docs/zh/config/output/filename.mdx index 3e71a3ee76..be2a5facd8 100644 --- a/website/docs/zh/config/output/filename.mdx +++ b/website/docs/zh/config/output/filename.mdx @@ -107,22 +107,22 @@ export default { 如果你在开发模式下设置了文件名的 hash,那么可能会导致热更新不生效(尤其是 CSS 文件)。这是因为每次文件内容变化时,都会引起 hash 变化,导致打包工具无法读取到最新的文件内容。 ::: -## 模板字符串 +## 文件名占位符 -在 `output.filename` 的值中,你可以使用模板字符串来动态生成文件名。 +在 `output.filename` 的值中,你可以使用文件名占位符来动态生成文件名。 -常用的模板字符串有: +常用的文件名占位符有: - `[name]` - entry 名称,即 [source.entry](/config/source/entry) 的 key。 - `[contenthash]` - 基于文件内容生成的 hash 值。 - `[contenthash:]` - 基于文件内容生成的 hash 值,并指定 hash 长度。 - `[ext]` - 文件后缀名,包含点号。 -> 更多模板字符串可以参考 [Rspack - Template String](https://rspack.rs/zh/config/output#template-string)。 +> 更多文件名占位符可以参考 [Rspack - 文件名占位符](https://rspack.rs/zh/config/filename-placeholders)。 :::tip -- `filename.html` 只能使用部分模板字符串,如 `[name]`、`[contenthash:]`。 +- `filename.html` 只能使用部分文件名占位符,如 `[name]`、`[contenthash:]`。 - `filename.js` 和 `filename.css` 不支持 `[ext]`。 :::