Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: better explanation for base configuration #8779

Merged
merged 5 commits into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/thin-flies-notice.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

Enrich the explanation of the `base` configuration with examples.
ematipico marked this conversation as resolved.
Show resolved Hide resolved
23 changes: 22 additions & 1 deletion packages/astro/src/@types/astro.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
*
* 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.
ematipico marked this conversation as resolved.
Show resolved Hide resolved
*
* 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/`.
ematipico marked this conversation as resolved.
Show resolved Hide resolved
*/
base?: string;

Expand Down