🔥 Add Firebase Hosting to Svelte

❓ What is this?

This is an experimental command to run to add hosting on Firebase to your SvelteKit project.

🛠 Usage

You must start with a fresh copy of the official SvelteKit template, which is currently created by running this command.

npm init svelte@next
# By the way, please listen to its warnings that SvelteKit is an alpha project
# https://svelte.dev/blog/whats-the-deal-with-sveltekit#When_can_I_start_using_it

Once that is set up, run this command in your project directory to set up hosting on Firebase:

npx apply svelte-add/firebase-hosting # --no-ssh

After the preset runs,

  • You cannot use server-side rendering. Your site must be static. This means that, among other things, svelte-add/graphql is currently not suitable to be hosted on Firebase.

  • Consider setting up GitHub Actions for automatic building and deployment to Firebase.

    Start by generating a CI login token from Firebase:

    npm run firebase login:ci
    

    Then, go to your repository's Settings > Secrets. Copy the result of the command above and save it as a Secret named FIREBASE_TOKEN.

    You can test if it's working by making a commit to main or master and checking the Actions tab of your repository to see if your project successfully builds and deploys to Firebase.

  • You can create a custom 404 page at src/routes/404.svelte.

  • You can use the deploy package script to manually deploy the site after a build.

  • You can apply another Svelte Adder to your project for more functionality.

😵 Help! I have a question

Create an issue and I'll try to help.

😡 Fix! There is something that needs improvement

Create an issue or pull request and I'll try to fix.

These are new tools, so there are likely to be problems in this project. Thank you for bringing them to my attention or fixing them for me.

📄 License

MIT


Repository preview image generated with GitHub Social Preview

This README was generated with ❤️ by readme-md-generator

Top categories

svelte logo

Want a Svelte site built?

Hire a Svelte developer
Loading Svelte Themes