router config

This commit is contained in:
Rachel Lambda Samuelsson 2024-07-15 20:19:43 +02:00
parent cd4c69c16b
commit 6cb0235ba5
10 changed files with 1436 additions and 8 deletions

1
.gitignore vendored
View File

@ -30,3 +30,4 @@ coverage
*.tsbuildinfo *.tsbuildinfo
result result
.direnv .direnv
.vite-ssg-temp/

1
env.d.ts vendored
View File

@ -1 +1,2 @@
/// <reference types="vite/client" /> /// <reference types="vite/client" />
/// <reference types="vite-plugin-pages/client" />

View File

@ -13,7 +13,7 @@
name = "rachel-blog-vue"; name = "rachel-blog-vue";
src = ./.; src = ./.;
npmBuildScript = "build-only"; npmBuildScript = "build-only";
npmDepsHash = "sha256-Bs6uurRg+D2f1A05TFwBpj84cxrLDuHt0Iv+SdyfTes="; npmDepsHash = "sha256-rlxTMuYSPMuSwP0zhqc3pEgG0AcuUGS8lofFjR1d9L4=";
installPhase = '' installPhase = ''
mv ./dist $out mv ./dist $out
''; '';

1407
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -7,7 +7,7 @@
"dev": "vite", "dev": "vite",
"build": "run-p type-check \"build-only {@}\" --", "build": "run-p type-check \"build-only {@}\" --",
"preview": "vite preview", "preview": "vite preview",
"build-only": "vite build", "build-only": "vite-ssg build",
"type-check": "vue-tsc --build --force" "type-check": "vue-tsc --build --force"
}, },
"dependencies": { "dependencies": {
@ -17,6 +17,7 @@
"devDependencies": { "devDependencies": {
"@tsconfig/node20": "^20.1.4", "@tsconfig/node20": "^20.1.4",
"@types/node": "^20.14.5", "@types/node": "^20.14.5",
"@unhead/vue": "^1.9.16",
"@vitejs/plugin-vue": "^5.0.5", "@vitejs/plugin-vue": "^5.0.5",
"@vue/language-server": "^2.0.26", "@vue/language-server": "^2.0.26",
"@vue/tsconfig": "^0.5.1", "@vue/tsconfig": "^0.5.1",
@ -25,6 +26,8 @@
"typescript": "~5.4.0", "typescript": "~5.4.0",
"typescript-language-server": "^4.3.3", "typescript-language-server": "^4.3.3",
"vite": "^5.3.1", "vite": "^5.3.1",
"vite-plugin-pages": "^0.32.3",
"vite-ssg": "^0.23.8",
"vue-tsc": "^2.0.21" "vue-tsc": "^2.0.21"
} }
} }

View File

@ -1,6 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import TheHeader from './components/TheHeader.vue' import TheHeader from './components/TheHeader.vue'
import ThePosts from './components/ThePosts.vue'
import TheFooter from './components/TheFooter.vue' import TheFooter from './components/TheFooter.vue'
</script> </script>
@ -10,7 +9,7 @@ import TheFooter from './components/TheFooter.vue'
<TheHeader /> <TheHeader />
</header> </header>
<main> <main>
<ThePosts /> <RouterView />
</main> </main>
<footer> <footer>
<TheFooter /> <TheFooter />

View File

@ -4,7 +4,9 @@
<template> <template>
<div class="sitetitle"> <div class="sitetitle">
<div class="titlecontainer"> <div class="titlecontainer">
<a href="/">rachel.cafe</a> <span>
<RouterLink to="/">rachel.cafe</RouterLink>
</span>
</div> </div>
</div> </div>
</template> </template>
@ -36,7 +38,7 @@
justify-content: center; justify-content: center;
} }
.titlecontainer a { .titlecontainer span {
font-size: 2em; font-size: 2em;
} }
</style> </style>

View File

@ -1,6 +1,12 @@
import './main.scss' import './main.scss'
import { createApp } from 'vue' import { ViteSSG } from 'vite-ssg'
import routes from '~pages'
import App from './App.vue' import App from './App.vue'
createApp(App).mount('#app') export const createApp = ViteSSG(
App,
{ routes },
(() => {})
)

7
src/pages/Index.vue Normal file
View File

@ -0,0 +1,7 @@
<script setup lang="ts">
import ThePosts from '../components/ThePosts.vue'
</script>
<template>
<ThePosts />
</template>

View File

@ -2,11 +2,13 @@ import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite' import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue' import vue from '@vitejs/plugin-vue'
import Pages from 'vite-plugin-pages'
// https://vitejs.dev/config/ // https://vitejs.dev/config/
export default defineConfig({ export default defineConfig({
plugins: [ plugins: [
vue(), vue(),
Pages()
], ],
resolve: { resolve: {
alias: { alias: {