Looking for a shareable component template? Go here --> sveltejs/component-template
This is a project template for Svelte apps built using Rollup that includes Typescript, SCSS, and Firebase support.
To create a new project based on this template using degit:
degit ShadowfeindX/svelte-rollup-scss-typescript-firebase svelte-app
cd svelte-app
Note that you will need to have Node.js and firebase-tools installed.
Install the dependencies...
cd svelte-app
yarn install
...initialize Firebase with your project details...
firebase init
...add your firebase config to src/firebase_config.ts
...
...then start the compiler.
yarn dev
To run the app locally you will need to have the firebase emulators installed. Once you have done that you can start the emulator suite by running yarn start
.
Navigate to localhost:5000. You should see your app running. Edit a component file in src
and save it. The browser should reload and show your changes.
The service worker and any other webworkers reside in service
. Your cloud functions reside in functions
. The compiler will automatically run whenever you change these files as well.
Your app will be listening on all hosts by default, meaning it can be accessed by other devices on your network. To disable this behavior, change the hosting settings in firebase.json
.
If you're using Visual Studio Code we recommend installing the official extension Svelte for VS Code. If you are using other editors you may need to install a plugin in order to get syntax highlighting and intellisense.
To create an optimised version of the app:
yarn build
Once you are satisfied with your application, you can deploy it to firebase by running yarn deploy
.