I would like to add a text file to /src
in a way that it always ends up unchanged in the root of the build directory (/public
).
In my case specifically I need to add a _redirects
file for Netlify to redirect a subdomain to a custom domain.
Running Gatsby 1.0 alpha.
Didn't need to put it in /src
. I just added it directly to /public
.
Even though it's in .gitignore
, I used git add -f /public/_redirects
, committed it, and it worked. It doesn't get deleted or overwritten during build.
Another way to do this (which I haven't tested) is to is to copy the file to its destination in /public as part of a post-build script in gatsby-node.js.