docs: better explanation for configuration
This commit is contained in:
parent
93b092266f
commit
f34f9cbbff
2 changed files with 27 additions and 1 deletions
5
.changeset/thin-flies-notice.md
Normal file
5
.changeset/thin-flies-notice.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
'astro': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Enrich the explanation of the `base` configuration with examples.
|
|
@ -580,7 +580,28 @@ export interface AstroUserConfig {
|
||||||
*
|
*
|
||||||
* When using this option, all of your static asset imports and URLs should add the base as a prefix. You can access this value via `import.meta.env.BASE_URL`.
|
* When using this option, all of your static asset imports and URLs should add the base as a prefix. You can access this value via `import.meta.env.BASE_URL`.
|
||||||
*
|
*
|
||||||
* The value of `import.meta.env.BASE_URL` respects your `trailingSlash` config and will include a trailing slash if you explicitly include one or if `trailingSlash: "always"` is set. If `trailingSlash: "never"` is set, `BASE_URL` will not include a trailing slash, even if `base` includes one.
|
* The value of `import.meta.env.BASE_URL` and configuration value `config.base` respects your `trailingSlash` config and will include a trailing slash if you explicitly include one or if `trailingSlash: "always"` is set. If `trailingSlash: "never"` is set, `BASE_URL` will not include a trailing slash, even if `base` includes one.
|
||||||
|
*
|
||||||
|
* This means with a configuration like this:
|
||||||
|
* ```js
|
||||||
|
* {
|
||||||
|
* base: '/docs/',
|
||||||
|
* trailingSlash: "never"
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* `import.meta.env.BASE_URL` and `config.base` will be `/docs`.
|
||||||
|
*
|
||||||
|
* In a configuration like this:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* {
|
||||||
|
* base: '/docs',
|
||||||
|
* trailingSlash: "always"
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* `import.meta.env.BASE_URL` and `config.base` will be `/docs/`.
|
||||||
*/
|
*/
|
||||||
base?: string;
|
base?: string;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue