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

feat(gatsby-cli): support for PREFIX_PATHS env variable #21627

24 changes: 12 additions & 12 deletions packages/gatsby-cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,25 +94,25 @@ At the root of a Gatsby app run `gatsby build` to do a production build of a sit

#### Options

| Option | Description | Default |
| :--------------------------: | ---------------------------------------------------------------------------------------------------------- | :-----: |
| `--prefix-paths` | Build site with link paths prefixed (set pathPrefix in your config) | `false` |
| `--no-uglify` | Build site without uglifying JS bundles (for debugging) | `false` |
| `--open-tracing-config-file` | Tracer configuration file (OpenTracing compatible). See https://www.gatsbyjs.org/docs/performance-tracing/ | |
| `--no-color`, `--no-colors` | Disables colored terminal output | `false` |
| Option | Description | Default |
| :--------------------------: | ---------------------------------------------------------------------------------------------------------- | :---------------------------: |
| `--prefix-paths` | Build site with link paths prefixed (set pathPrefix in your config) | `env.PREFIX_PATHS` or `false` |
| `--no-uglify` | Build site without uglifying JS bundles (for debugging) | `false` |
| `--open-tracing-config-file` | Tracer configuration file (OpenTracing compatible). See https://www.gatsbyjs.org/docs/performance-tracing/ | |
| `--no-color`, `--no-colors` | Disables colored terminal output | `false` |

### `serve`

At the root of a Gatsby app run `gatsby serve` to serve the production build of the site

#### Options

| Option | Description |
| :--------------: | ---------------------------------------------------------------------------------------- |
| `-H`, `--host` | Set host. Defaults to localhost |
| `-p`, `--port` | Set port. Defaults to 9000 |
| `-o`, `--open` | Open the site in your (default) browser for you |
| `--prefix-paths` | Serve site with link paths prefixed (if built with pathPrefix in your gatsby-config.js). |
| Option | Description | Default |
| :--------------: | ---------------------------------------------------------------------------------------- | :---------------------------: |
| `-H`, `--host` | Set host. Defaults to localhost | |
| `-p`, `--port` | Set port. Defaults to 9000 | |
| `-o`, `--open` | Open the site in your (default) browser for you | |
| `--prefix-paths` | Serve site with link paths prefixed (if built with pathPrefix in your gatsby-config.js). | `env.PREFIX_PATHS` or `false` |

### `clean`

Expand Down
12 changes: 8 additions & 4 deletions packages/gatsby-cli/src/create-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,10 @@ function buildLocalCommands(cli, isLocalSite) {
builder: _ =>
_.option(`prefix-paths`, {
type: `boolean`,
default: false,
describe: `Build site with link paths prefixed (set pathPrefix in your gatsby-config.js).`,
default: process.env.PREFIX_PATHS || false,
benrobertsonio marked this conversation as resolved.
Show resolved Hide resolved
describe: process.env.PREFIX_PATHS
? `Build site with link paths prefixed (set by env.PREFIX_PATHS) (set pathPrefix in your gatsby-config.js).`
: `Build site with link paths prefixed (set pathPrefix in your gatsby-config.js).`,
benrobertsonio marked this conversation as resolved.
Show resolved Hide resolved
})
.option(`no-uglify`, {
type: `boolean`,
Expand Down Expand Up @@ -209,8 +211,10 @@ function buildLocalCommands(cli, isLocalSite) {
})
.option(`prefix-paths`, {
type: `boolean`,
default: false,
describe: `Serve site with link paths prefixed (if built with pathPrefix in your gatsby-config.js).`,
default: process.env.PREFIX_PATHS || false,
benrobertsonio marked this conversation as resolved.
Show resolved Hide resolved
describe: process.env.PREFIX_PATHS
? `Serve site with link paths prefixed (set by env.PREFIX_PATHS) (set pathPrefix in your gatsby-config.js).`
: `Serve site with link paths prefixed (set pathPrefix in your gatsby-config.js).`,
}),

handler: getCommandHandler(`serve`),
Expand Down