npm create vite@latest . -- --template svelte-ts
.vscode/
public/
src/assets
src/lib
App.svelte
with:<main>
<h1>Hello World</h1>
<p>Welcome to my website</p>
</main>
npm install -D tailwindcss@latest postcss@latest autoprefixer@latest
npx tailwindcss init -p
tailwind.config.cjs
with:module.exports = {
content: ["./index.html", "./src/**/*.{html,js,ts,svelte}"],
app.css
with:@tailwind base;
@tailwind components;
@tailwind utilities;
App.svelte
<main>
<h1 class="font-bold">Hello World</h1>
<p>Welcome to my website</p>
</main>
npm run dev
Navigate to your repository's settings page under pages
set source to GitHub Actions
and define your own action something like so:
name: Github Pages build and deployment
on:
push:
branches:
- main
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: 19
- name: Install dependencies
run: npm install
- name: Build project
run: npm run build
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: ./dist
deploy:
needs: build
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1