html.templateParameters
- Type:
Record<string, unknown> | Function - Default:
Define the parameters in the HTML template, see HTML Template - Template Parameters for detailed usage.
Object usage
If the value of templateParameters is an object, it will be merged with the default parameters using Object.assign.
For example, if you need to use the foo parameter in an HTML template, you can add the following settings:
rsbuild.config.ts
Then, you can read the parameter in the HTML template using <%= foo %>:
The compiled HTML code will be:
Function usage
- Type:
When html.templateParameters is of type Function, the function receives two parameters:
value: DefaulttemplateParametersconfiguration of Rsbuild.utils: An object containing theentryNamefield, corresponding to the name of the current entry.
In the context of a multi-page application (MPA), you can set different templateParameters based on the entry name:
rsbuild.config.ts

