I am currently hosting a static website through Firebase, but the one file being served (index.html
) exists in my Mac computer's Public folder. Since I would like to serve other files, I want to move the index to a project folder that will contain future linked files (e.g. /public/my-project/index.html
).
How would I go about updating the file path/directory?
In your project directory (the directory in which you run firebase deploy
or firebase deploy --only hosting
), open or create firebase.json
and make sure it points to the correct public folder.
{
"hosting": {
"public": "public"
}
}
This is a relative path. If your project and your firebase.json
are located in /projects/my-project
, this will deploy everything in /projects/my-project/public
.
All of this is set up automatically if you initialize your Firebase project with firebase init
.
Since your project may contain lots of files that aren't supposed to be deployed (readme, node_modules, build scripts etc.), I'd recommend having a public
folder inside the project folder, like described above. (You can, however, ignore files with the ignore
option, but you'd like to keep this list of ignored files manageable.)
If you really don't want a public
folder inside your project, you may try pointing to the current folder from your firebase.json
:
{
"hosting": {
"public": "."
}
}
More information about hosting configuration: https://firebase.google.com/docs/hosting/full-config