[docs] Document base (#5693)

This commit is contained in:
Sarah Rainsberger 2023-01-04 16:50:23 -04:00 committed by GitHub
parent c0d3877d0d
commit 5df4a89a3a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -424,15 +424,22 @@ export interface AstroUserConfig {
* @name base
* @type {string}
* @description
* The base path to deploy to. Astro will build your pages and assets using this path as the root. Currently, this has no effect during development.
* The base path to deploy to. Astro will use this path as the root for your pages and assets both in development and in production build.
*
* You can access this value in your app via `import.meta.env.BASE_URL`.
* In the example below, `astro dev` will start your server at `/docs`.
*
* ```js
* {
* base: '/docs'
* }
* ```
*
* 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`.
*
* ```astro
* <a href="/docs/about/">About</a>
* <img src=`${import.meta.env.BASE_URL}/image.png`>
* ```
*/
base?: string;