Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/stroblp/svelte-gh-pages
quick tutorial about deploying svelte apps to GitHub pages
https://github.com/stroblp/svelte-gh-pages
deployment github-pages svelte
Last synced: 11 days ago
JSON representation
quick tutorial about deploying svelte apps to GitHub pages
- Host: GitHub
- URL: https://github.com/stroblp/svelte-gh-pages
- Owner: stroblp
- Created: 2022-04-02T21:10:28.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-04-02T22:15:28.000Z (over 2 years ago)
- Last Synced: 2024-03-03T11:39:33.940Z (9 months ago)
- Topics: deployment, github-pages, svelte
- Language: Svelte
- Homepage: https://stroblp.github.io/svelte-gh-pages/
- Size: 29.3 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Deploying Svelte App to GitHub Pages
# Introduction
Short turorial to deploy Svelte app to GitHub Pages.
# svelte app
Create Svelte app
```
npm create vite@latest
```
### Install the `gh-pages` npm packageInstall the [`gh-pages`](https://github.com/tschaub/gh-pages) npm package
```
$ npm install gh-pages --save-dev
```Follow instructions
### Add a `homepage` property to the `package.json` file
Add a `homepage` property in this format\*: `https://{username}.github.io/{repo-name}`
```
"name": "svelte-app",
"version": "0.1.0",
"homepage": "https://{username}.github.io/{repo-name}",
"private": true,
```### Add base url in `vite.conf.js`
```
export default defineConfig({
plugins: [svelte()],
base:"/{repo-name}/"
})
```
### Add deploy to the `package.json` fileAdd a `deploy` to the `scripts` object:
```
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview",
"deploy": "gh-pages -d dist"
}
```### Deploy the Svelte app to GitHub Pages
Build and deploy the Svelte app to GitHub Pages
```
npm run build
npm run deploy
```### The end
[`deployed svelte app`](https://stroblp.github.io/svelte-gh-pages/)