These instructions will lead you through how to deploy a static website on firebase
- Sign up for an account on Firebase.
- In your terminal, install the Firebase CLI tools. (This also updates you to the latest version of firebase.)
$ npm install -g firebase-tools
- Authorize your computer to have access to your Firebase account
$ firebase login
- Initialize a new project in your project directory (where index.html lives)
$ firebase init
-
The terminal will prompt "What Firebase CLI features do you want to setup for this folder?" Both database and hosting are pre-selected. Unselect the database option by hitting the space bar, leave hosting option selected, and press enter.
-
Select
[create a new project]
and hit enter. -
"What do you want to use as your project directory?" (public) will be pre-populated. Hit
.
This will use your current location for your project directory, so it is important that you are in the directory you want to deploy. -
"Configure as a single page app (rewrite all urls to /index.html)"? No
-
"File ./index.html already exists. Overwrite?" No
- Firebase Initialization is complete! Now go to the Firebase Console and click "Create New Project".
- Once the project has been created, type
firebase use --add
in the terminal and select the project name you just created. "What do you want to use as an alias for this project?" Type an alias and hit enter. - Deploy:
$ firebase deploy
- Once the site has been deployed, the terminal will list the hosting URL. Copy and paste the URL and check out your first deployed static site!
Let's play around with re-deploying.
- Add an h1 to the HTML, run
firebase deploy
, and see the changes. - Then make a change to the CSS and
firebase deploy
again! As you make any changes, keep usingfirebase deploy
to keep your deployed site up to date.