Skip to content
This repository was archived by the owner on Dec 19, 2023. It is now read-only.

Commit 9d80013

Browse files
authored
add siteBasePath example (#82)
1 parent fd1f165 commit 9d80013

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,17 @@ In the default value, `project-root` refers to the directory of your `underreact
531531

532532
Type: `string`. Default: `'/'`.
533533

534-
Path to the base directory on the domain where the site will be deployed. The default value is the domain's root. To help create valid links, Underreact exposes this value to your source with an environment variable `BASE_PATH`. Read ["How do I include SVGs, images, and videos?"](#how-do-i-include-svgs-images-and-videos).
534+
Path to the base directory on the domain where the site will be deployed. The default value is the domain's root. To help create valid links, Underreact exposes this value to your source code with an environment variable `BASE_PATH`. The table below gives an example of how Underreact sets `BASE_PATH` environment variable for a given `siteBasePath` value:
535+
536+
| siteBasePath | process.env.BASE_PATH |
537+
| ------------ | --------------------- |
538+
| (not set) | "" |
539+
| "/" | "" |
540+
| "ketchup" | "/ketchup" |
541+
| "/ketchup" | "/ketchup" |
542+
| "/ketchup/" | "/ketchup" |
543+
544+
This normalization behaviour comes in handy when writing statements like `process.env.BASE_PATH + '/my-path'`. Read ["How do I include SVGs, images, and videos?"](#how-do-i-include-svgs-images-and-videos).
535545

536546
**Tip**: There's a good chance your app isn't at the root of your domain. So this option represents the path of your site *within* that domain. For example, if your app is at `https://www.special.com/ketchup/*`, you should set `siteBasePath: '/ketchup'`.
537547

0 commit comments

Comments
 (0)