This commit is contained in:
2026-05-14 09:53:22 +08:00
commit e0e8684f53
23 changed files with 2207 additions and 0 deletions

7
src/App.vue Normal file
View File

@@ -0,0 +1,7 @@
<template>
<RouterView />
</template>
<script setup lang="ts">
import { RouterView } from 'vue-router'
</script>

BIN
src/assets/hero.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

1
src/assets/vite.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 8.5 KiB

1
src/assets/vue.svg Normal file
View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="37.07" height="36" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 198"><path fill="#41B883" d="M204.8 0H256L128 220.8L0 0h97.92L128 51.2L157.44 0h47.36Z"></path><path fill="#41B883" d="m0 0l128 220.8L256 0h-51.2L128 132.48L50.56 0H0Z"></path><path fill="#35495E" d="M50.56 0L128 133.12L204.8 0h-47.36L128 51.2L97.92 0H50.56Z"></path></svg>

After

Width:  |  Height:  |  Size: 496 B

9
src/main.ts Normal file
View File

@@ -0,0 +1,9 @@
import { ViteSSG } from 'vite-ssg'
import App from './App.vue'
import { routes } from './routes'
import './style.css'
export const createApp = ViteSSG(App, {
routes,
base: import.meta.env.BASE_URL,
})

27
src/pages/AboutView.vue Normal file
View File

@@ -0,0 +1,27 @@
<template>
<main class="placeholder-page">
<p class="placeholder-kicker">
Static route
</p>
<h1>About</h1>
<p>
This placeholder verifies that the about page is rendered as a static
route by Vite SSG.
</p>
<a href="/">Back home</a>
</main>
</template>
<script setup lang="ts">
import { useHead } from '@unhead/vue'
useHead({
title: 'About | test-ssg',
meta: [
{
name: 'description',
content: 'About page placeholder for the Vite SSG test site.',
},
],
})
</script>

27
src/pages/ContactView.vue Normal file
View File

@@ -0,0 +1,27 @@
<template>
<main class="placeholder-page">
<p class="placeholder-kicker">
Static route
</p>
<h1>Contact</h1>
<p>
This placeholder verifies that the contact page is rendered as a static
route by Vite SSG.
</p>
<a href="/">Back home</a>
</main>
</template>
<script setup lang="ts">
import { useHead } from '@unhead/vue'
useHead({
title: 'Contact | test-ssg',
meta: [
{
name: 'description',
content: 'Contact page placeholder for the Vite SSG test site.',
},
],
})
</script>

60
src/pages/HomeView.vue Normal file
View File

@@ -0,0 +1,60 @@
<template>
<section id="center">
<div class="hero">
<img :src="heroImg" class="base" width="170" height="179" alt="" />
<img :src="vueLogo" class="framework" alt="Vue logo" />
<img :src="viteLogo" class="vite" alt="Vite logo" />
</div>
<div>
<h1>Get started</h1>
<p>Edit <code>src/pages/HomeView.vue</code> and save to test <code>HMR</code></p>
</div>
<button type="button" class="counter" @click="count++">
Count is {{ count }}
</button>
<nav class="site-pages" aria-label="Site pages">
<RouterLink
v-for="page in pageLinks"
:key="page.to"
class="site-page-link"
:to="page.to"
>
{{ page.label }}
</RouterLink>
</nav>
</section>
<div class="ticks"></div>
<div class="ticks"></div>
<section id="spacer"></section>
</template>
<script setup lang="ts">
import { useHead } from '@unhead/vue'
import { shallowRef } from 'vue'
import { RouterLink } from 'vue-router'
import heroImg from '../assets/hero.png'
import viteLogo from '../assets/vite.svg'
import vueLogo from '../assets/vue.svg'
const count = shallowRef(0)
const pageLinks = [
{ label: 'Home', to: '/' },
{ label: 'About', to: '/about' },
{ label: 'Products', to: '/products' },
{ label: 'Contact', to: '/contact' },
] as const
useHead({
title: 'Home | test-ssg',
meta: [
{
name: 'description',
content: 'Static generated home page for the Vite SSG test site.',
},
],
})
</script>

View File

@@ -0,0 +1,27 @@
<template>
<main class="placeholder-page">
<p class="placeholder-kicker">
Static route
</p>
<h1>Products</h1>
<p>
This placeholder verifies that the products page is rendered as a static
route by Vite SSG.
</p>
<a href="/">Back home</a>
</main>
</template>
<script setup lang="ts">
import { useHead } from '@unhead/vue'
useHead({
title: 'Products | test-ssg',
meta: [
{
name: 'description',
content: 'Products page placeholder for the Vite SSG test site.',
},
],
})
</script>

28
src/routes.ts Normal file
View File

@@ -0,0 +1,28 @@
import type { RouteRecordRaw } from 'vue-router'
import AboutView from './pages/AboutView.vue'
import ContactView from './pages/ContactView.vue'
import HomeView from './pages/HomeView.vue'
import ProductsView from './pages/ProductsView.vue'
export const routes: RouteRecordRaw[] = [
{
path: '/',
name: 'home',
component: HomeView,
},
{
path: '/about',
name: 'about',
component: AboutView,
},
{
path: '/products',
name: 'products',
component: ProductsView,
},
{
path: '/contact',
name: 'contact',
component: ContactView,
},
]

365
src/style.css Normal file
View File

@@ -0,0 +1,365 @@
:root {
--text: #6b6375;
--text-h: #08060d;
--bg: #fff;
--border: #e5e4e7;
--code-bg: #f4f3ec;
--accent: #aa3bff;
--accent-bg: rgba(170, 59, 255, 0.1);
--accent-border: rgba(170, 59, 255, 0.5);
--social-bg: rgba(244, 243, 236, 0.5);
--shadow:
rgba(0, 0, 0, 0.1) 0 10px 15px -3px, rgba(0, 0, 0, 0.05) 0 4px 6px -2px;
--sans: system-ui, 'Segoe UI', Roboto, sans-serif;
--heading: system-ui, 'Segoe UI', Roboto, sans-serif;
--mono: ui-monospace, Consolas, monospace;
font: 18px/145% var(--sans);
letter-spacing: 0.18px;
color-scheme: light dark;
color: var(--text);
background: var(--bg);
font-synthesis: none;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
@media (max-width: 1024px) {
font-size: 16px;
}
}
@media (prefers-color-scheme: dark) {
:root {
--text: #9ca3af;
--text-h: #f3f4f6;
--bg: #16171d;
--border: #2e303a;
--code-bg: #1f2028;
--accent: #c084fc;
--accent-bg: rgba(192, 132, 252, 0.15);
--accent-border: rgba(192, 132, 252, 0.5);
--social-bg: rgba(47, 48, 58, 0.5);
--shadow:
rgba(0, 0, 0, 0.4) 0 10px 15px -3px, rgba(0, 0, 0, 0.25) 0 4px 6px -2px;
}
#social .button-icon {
filter: invert(1) brightness(2);
}
}
body {
margin: 0;
}
h1,
h2 {
font-family: var(--heading);
font-weight: 500;
color: var(--text-h);
}
h1 {
font-size: 56px;
letter-spacing: -1.68px;
margin: 32px 0;
@media (max-width: 1024px) {
font-size: 36px;
margin: 20px 0;
}
}
h2 {
font-size: 24px;
line-height: 118%;
letter-spacing: -0.24px;
margin: 0 0 8px;
@media (max-width: 1024px) {
font-size: 20px;
}
}
p {
margin: 0;
}
code,
.counter {
font-family: var(--mono);
display: inline-flex;
border-radius: 4px;
color: var(--text-h);
}
code {
font-size: 15px;
line-height: 135%;
padding: 4px 8px;
background: var(--code-bg);
}
.counter {
font-size: 16px;
padding: 5px 10px;
border-radius: 5px;
color: var(--accent);
background: var(--accent-bg);
border: 2px solid transparent;
transition: border-color 0.3s;
margin-bottom: 24px;
&:hover {
border-color: var(--accent-border);
}
&:focus-visible {
outline: 2px solid var(--accent);
outline-offset: 2px;
}
}
.site-pages {
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 10px;
}
.site-page-link {
min-width: 92px;
padding: 8px 14px;
border: 1px solid var(--border);
border-radius: 6px;
color: var(--text-h);
background: var(--social-bg);
font-size: 15px;
line-height: 1.2;
text-decoration: none;
box-sizing: border-box;
transition:
border-color 0.2s,
color 0.2s,
box-shadow 0.2s;
&:hover,
&:focus-visible,
&.router-link-active {
border-color: var(--accent-border);
color: var(--accent);
}
&:focus-visible {
outline: 2px solid var(--accent);
outline-offset: 2px;
}
@media (max-width: 480px) {
flex: 1 1 calc(50% - 10px);
}
}
.hero {
position: relative;
.base,
.framework,
.vite {
inset-inline: 0;
margin: 0 auto;
}
.base {
width: 170px;
position: relative;
z-index: 0;
}
.framework,
.vite {
position: absolute;
}
.framework {
z-index: 1;
top: 34px;
height: 28px;
transform: perspective(2000px) rotateZ(300deg) rotateX(44deg) rotateY(39deg)
scale(1.4);
}
.vite {
z-index: 0;
top: 107px;
height: 26px;
width: auto;
transform: perspective(2000px) rotateZ(300deg) rotateX(40deg) rotateY(39deg)
scale(0.8);
}
}
#app {
width: 1126px;
max-width: 100%;
margin: 0 auto;
text-align: center;
border-inline: 1px solid var(--border);
min-height: 100svh;
display: flex;
flex-direction: column;
box-sizing: border-box;
}
#center {
display: flex;
flex-direction: column;
gap: 25px;
place-content: center;
place-items: center;
flex-grow: 1;
@media (max-width: 1024px) {
padding: 32px 20px 24px;
gap: 18px;
}
}
#next-steps {
display: flex;
border-top: 1px solid var(--border);
text-align: left;
& > div {
flex: 1 1 0;
padding: 32px;
@media (max-width: 1024px) {
padding: 24px 20px;
}
}
.icon {
margin-bottom: 16px;
width: 22px;
height: 22px;
}
@media (max-width: 1024px) {
flex-direction: column;
text-align: center;
}
}
#docs {
border-right: 1px solid var(--border);
@media (max-width: 1024px) {
border-right: none;
border-bottom: 1px solid var(--border);
}
}
#next-steps ul {
list-style: none;
padding: 0;
display: flex;
gap: 8px;
margin: 32px 0 0;
.logo {
height: 18px;
}
a {
color: var(--text-h);
font-size: 16px;
border-radius: 6px;
background: var(--social-bg);
display: flex;
padding: 6px 12px;
align-items: center;
gap: 8px;
text-decoration: none;
transition: box-shadow 0.3s;
&:hover {
box-shadow: var(--shadow);
}
.button-icon {
height: 18px;
width: 18px;
}
}
@media (max-width: 1024px) {
margin-top: 20px;
flex-wrap: wrap;
justify-content: center;
li {
flex: 1 1 calc(50% - 8px);
}
a {
width: 100%;
justify-content: center;
box-sizing: border-box;
}
}
}
#spacer {
height: 88px;
border-top: 1px solid var(--border);
@media (max-width: 1024px) {
height: 48px;
}
}
.ticks {
position: relative;
width: 100%;
&::before,
&::after {
content: '';
position: absolute;
top: -4.5px;
border: 5px solid transparent;
}
&::before {
left: 0;
border-left-color: var(--border);
}
&::after {
right: 0;
border-right-color: var(--border);
}
}
.placeholder-page {
min-height: 100svh;
padding: 96px 24px;
box-sizing: border-box;
display: flex;
flex-direction: column;
place-content: center;
place-items: center;
gap: 16px;
}
.placeholder-page p {
max-width: 560px;
}
.placeholder-page a {
color: var(--accent);
text-decoration-thickness: 2px;
text-underline-offset: 4px;
}
.placeholder-kicker {
color: var(--accent);
font-family: var(--mono);
font-size: 14px;
letter-spacing: 0;
text-transform: uppercase;
}