When I open a terminal in my firebase folder with all the dependancies and files etc, and I type 'firebase deploy' into the terminal, all works fine and functions are updated and rules are updated, but the changes to index.html are not pushed to the website. Is there a setting I can check or something that would make it push again?
4
-
You haven’t said how you’re checking for the changes. Is it possible that you’re seeing a cached version of the page in your browser?Aankhen– Aankhen2018-06-26 11:29:08 +00:00Commented Jun 26, 2018 at 11:29
-
This SO Post may interest you: stackoverflow.com/questions/48589821/…Renaud Tarnec– Renaud Tarnec2018-06-26 11:32:59 +00:00Commented Jun 26, 2018 at 11:32
-
I clear any cookies or cached files and then load my website and then view the source in chrome, and can see that no changes have occurred.Ryan– Ryan2018-06-26 11:41:34 +00:00Commented Jun 26, 2018 at 11:41
-
Firebase default cache is 1 hour. If you have not changed that Firebase may continue to serve you the old index.html file for an hour after you deploy it.abraham– abraham2018-06-26 19:25:55 +00:00Commented Jun 26, 2018 at 19:25
Add a comment
|
2 Answers
Assuming you are hosting the index.html in addition to function deployments: Is the index.html file in the folder specified under "hosting": { and not in the ignored files?
You can also run firebase deploy --only hosting to only deploy hosting related changes.
Since the file is in your root directory you need to set that as the public directory for firebase
{
"hosting": {
"public": "/",
...
}
}
3 Comments
Ryan
This is my firebase.json My index.html file is stored directly in the folder (no subfolders or anything)
Ronnie Smith
The issue with modifying the default to host out of root is that your
firestore.rules and a bunch of other non-public files are gonna be viewable on the web, unless you go in and exclude them from being hosted. ...basically - don't do it. It's unnecessary over-complication. ...keep it simple.anoff
I have to agree with @RonRoyston. I think you would do yourself a favor and put that index in a separate folder, as stupid as it may sound for a single file. My answer was simply trying to be as close to the question as possible.
Put your index.html file in the /public folder, which is what is being served on Firebase Hosting. This is the way you want it. You don't want to publish files at the root directory.
2 Comments
Ryan
I thought there were 2 different index.html files, one in public and one in root. Am I mistaken? Should my main one be the one in public?
Ronnie Smith
the one in root was put there when you created your
new HTML5 project in your IDE (most likely). No, you only want the one index.html in /public. Note, it's perfectly valid to have additional index.html in subfolders, say for example /public/articles/index.html will display at //your-domain/articles.html but no, the one in the root directory can be destroyed/deleted, based on your firebase config file.