CLI: Allow pathPrefix
configuration as command line argument
#36180
Unanswered
JamesMGreene
asked this question in
Ideas / Feature Requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Describe the feature you'd like to request
When I want to do a production deploy of a static HTML export of a Gatsby site to GitHub Pages, or as a piece of a larger site, I need to:
pathPrefix
configuration of something like"/repoName/"
to thegatsby-config.js
filegatsby build
with with a flag of--prefix-paths
or an environment variable ofPREFIX_PATHS=true
I'm seeking a way to more easily automate Gatsby projects across my organization, especially without need to worry about their particular application setup (CommonJS, ESM, TypeScript, etc.). As such, I would like to eliminate the need for the manual editing of the configuration file in Step 1 by combining it into Step 2.
Describe the solution you'd like
I would like to be able to pass the desired
pathPrefix
configuration value as a command line argument to the necessarygatsby
CLI commands, e.g.gatsby build --path-prefix=/repoName/
.Describe alternatives you've considered
The only good alternative I've found is requiring all of the projects to use a consistent snippet to support conditional values, e.g. using an environment variable to modify the
pathPrefix
value:Alas, that requires changes to all of the repositories' codebase as well as participation/enforcement to ensure they remain in that kind of an ideal pattern. 😕
On the plus side, Gatsby is at least closer to what I want than Next.js or NuxtJS, since Gatsby will ignore the
pathPrefix
unless the flag or environment variable are specified. 🤔Prior Art
--pathprefix
: https://www.11ty.dev/docs/config/#deploy-to-a-subdirectory-with-a-path-prefix--baseurl
: https://jekyllrb.com/docs/configuration/options/#build-command-options--baseURL
: https://gohugo.io/commands/hugo/Beta Was this translation helpful? Give feedback.
All reactions