Configurable output folder #1878
Replies: 76 comments 8 replies
-
Do you have a specific use case in mind? This has been discussed before but no one has come up with a concrete use case that justified adding a new option. Every option we add to Gatsby makes the project more complex which has all sorts of long-term costs so unless something is really valuable, I'd rather people handle this sort of thing themselves e.g. just copy the files to the output directory you want or create a symlink. This could easily be turned into a plugin that people could install, etc. |
Beta Was this translation helpful? Give feedback.
-
Yes, I have a use-case. I am going to use Gatsby for a documentation part as a part of complex project. All static files (Gatsby output, plus some others) should be placed into one folder So far I have worked this around in
Adding configurable output folder will reduce this complexity and will help me not to move files around one more time. |
Beta Was this translation helpful? Give feedback.
-
Why do outputted files need to be in a folder named "build"? |
Beta Was this translation helpful? Give feedback.
-
Because I am composing the final result not only from Gatsby output, but also from some other sources. Gatsby will be responsible only for
|
Beta Was this translation helpful? Give feedback.
-
I have a similar requirement, but I just use the CI tool to rename/move the folder as a post build step... I wouldn't say it's a gatsby concern this. Feels very CI to me. |
Beta Was this translation helpful? Give feedback.
-
For the time being, I have to do the same, that I have mentioned in the my comment above. But there are some downsides:
|
Beta Was this translation helpful? Give feedback.
-
The general rule of thumb is only put stuff in core that can only be done in core and since this is more trivial to do in userland than core, I'm marking this #wontfix. I'd love to see a plugin that implements a very efficient sync step to another directory e.g. default to rsync if available and use a node rsync-like implementation. Re: #1811 rsync makes it easy to sync deletes as well. |
Beta Was this translation helpful? Give feedback.
-
@KyleAMathews We use a generic continuous integration configuration for all our projects, based on a Any way of reconsider this feature? |
Beta Was this translation helpful? Give feedback.
-
Seems like a pretty trivial addition many people would find useful IHMO. Github pages expects the output to be in the root of the repository or in a |
Beta Was this translation helpful? Give feedback.
-
Ok — I guess it is annoying enough / inefficient enough to have to copy files around to add this as an option. Who wants to own the change? Public is hardcoded a number of places in the codebase. Also the new option would need documented, etc. |
Beta Was this translation helpful? Give feedback.
-
What's the update on this issue? It looks like there are a couple pull requests ready but not merged yet. What else do the PRs need to be ready? |
Beta Was this translation helpful? Give feedback.
-
#4756 had a few issues and was reverted. Reopening this. |
Beta Was this translation helpful? Give feedback.
-
What issues did it have? |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
I would vouch the benefits of configurable output folder. Easiest use case is #4512 (differentiating dev and production build destination), very useful when opening production result in one browser tab (via |
Beta Was this translation helpful? Give feedback.
-
It would be great if there was an option to control output for at least html vs assets files. They often are moved to CDN (at least in my experience) and it would be much easier to have them grouped + properly configured urls with |
Beta Was this translation helpful? Give feedback.
-
Any estimated time on when this feature will be implemented? I think it would be really useful. |
Beta Was this translation helpful? Give feedback.
-
I would also like this. My use case is that some clients want a Sanity studio client with Gatsby for the web app, where I run both through Netlify (e.g.; Netlify actually manages both the Sanity studio and Gatsby web app at a single URL rather than the more basic approach where they have separate domains). In order to make this a sane developer experience, the Sanity and Gatsby apps exist as separate sub folders in a
|
Beta Was this translation helpful? Give feedback.
-
I have another use case: I have multiple websites that derive from a main website. All that changes is a google analytics. I could copy paste the whole project, but doesn't make sense. So currently I need to deploy each website sequentially. Another problem is that keeps accumulating js files from variant A to variant B... so variant X will have all js from previous variants. Would be cool to output to They all get deployed to a different domain. The reason I'd need this feature is to be able to run in parallel all the variant builds + reduce amount of js deployed. |
Beta Was this translation helpful? Give feedback.
-
All discussions about simply moving things around in bash doesnt solve the Problem running gatsby in a readonly Filesystem (Lambda). so gatsby is simply not usable within cloudfunctions: so a big nope for gatsby. I recommend react-static (where it was clean to implement and contribute) |
Beta Was this translation helpful? Give feedback.
-
My project is using automated build on github followed by publishing to github pages. The folder name on github is |
Beta Was this translation helpful? Give feedback.
-
I guess we all agree :) |
Beta Was this translation helpful? Give feedback.
-
I want to second this feature. Currently the output directory has a mix of cache-busting JS/CSS files and HTML, which makes it really hard to separate manually with scripts. For my particular use case, I deploy Gatsby via FTP, and when updating the site, it would be convenient to have a configurable output directory structure so that I know which directories to replace. |
Beta Was this translation helpful? Give feedback.
-
Why do I get mails that this issue has been closed? This issue is not fixed and hence should not be closed. Thank you! |
Beta Was this translation helpful? Give feedback.
-
Why was this closed without further discussion? |
Beta Was this translation helpful? Give feedback.
-
any updates? |
Beta Was this translation helpful? Give feedback.
-
I thought Deploy Directions are meant to allow me to modify the output directory, but they are not. I also have no idea why the issue was closed and converted to a discussion. In my opinion, there is nothing to discuss. To be able to configure the output path of a build should be a no-brainer, imho. Now we are forced to make hacky stuff that works on all platforms, such as doing npm i rsync -D and modifying the gatsby build && rsync -av --delete public/ path/to/new/folder |
Beta Was this translation helpful? Give feedback.
-
I did 2 years ago: #1878 (comment) #12501 |
Beta Was this translation helpful? Give feedback.
-
Hi there ! I found a solution to get both
For this solution working, As of today solution this works pretty well. |
Beta Was this translation helpful? Give feedback.
-
Currently the project is always generating content into
public
folder. It is fine for most cases, however some people have different project structure and want to change it.How do you think about making this configurable via CLI argument or
gatsby-config.js
? For example:public
will remain default, of course.Beta Was this translation helpful? Give feedback.
All reactions