Skip to content

Commit 9686991

Browse files
Update from Copier (2026-08-30T10-32-08Z)
Signed-off-by: python-templates-copier-update[bot] <python-templates-copier-update[bot]@users.noreply.github.com>
1 parent f8adaa6 commit 9686991

13 files changed

Lines changed: 185 additions & 14 deletions

File tree

‎.copier-answers.yaml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Changes here will be overwritten by Copier
2-
_commit: 7522e24
2+
_commit: 195919b
33
_src_path: https://github.com/python-project-templates/base.git
44
add_extension: site-sveltekit
55
brand_name: Example
@@ -8,3 +8,4 @@ project_description: A fast, accessible SvelteKit website.
88
project_name: javascript-template-site-sveltekit
99
site_adapter: static
1010
site_url: https://example.com
11+

‎README.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,7 @@ pnpm test
1818
pnpm build
1919
```
2020

21+
Visual regression snapshots live beside `tests/visual/` and are skipped when `CI` is set. Record or
22+
refresh them locally with `pnpm test:e2e:update`.
23+
2124
This site uses SvelteKit's `adapter-static` deployment adapter.

‎playwright.config.ts‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,16 @@ import { defineConfig, devices } from '@playwright/test';
22

33
export default defineConfig({
44
testDir: 'tests',
5+
testMatch: ['**/*.spec.ts'],
6+
testIgnore: process.env.CI ? ['**/visual/**'] : [],
7+
snapshotPathTemplate: '{testDir}/{testFilePath}-snapshots/{arg}-{projectName}{ext}',
58
fullyParallel: true,
69
forbidOnly: !!process.env.CI,
710
retries: process.env.CI ? 2 : 0,
811
reporter: process.env.CI ? 'github' : 'list',
12+
expect: {
13+
toHaveScreenshot: { maxDiffPixelRatio: 0.01, threshold: 0.2, animations: 'disabled', caret: 'hide' }
14+
},
915
use: {
1016
baseURL: 'http://127.0.0.1:4177',
1117
trace: 'retain-on-failure',
@@ -18,9 +24,7 @@ export default defineConfig({
1824
timeout: 120_000
1925
},
2026
projects: [
21-
{
22-
name: 'desktop',
23-
use: { ...devices['Desktop Chrome'], viewport: { width: 1280, height: 800 } }
24-
}
27+
{ name: 'desktop', use: { ...devices['Desktop Chrome'], viewport: { width: 1280, height: 800 } } },
28+
{ name: 'mobile', use: { ...devices['Desktop Chrome'], viewport: { width: 390, height: 844 } } }
2529
]
2630
});

‎src/app.css‎

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,35 @@
11
@import 'tailwindcss';
22

33
:root {
4-
color: #171717;
5-
background: #ffffff;
6-
font-family: system-ui, sans-serif;
4+
--paper: #ffffff;
5+
--ink: #171717;
6+
--muted: #5c5c5c;
7+
--line: #e4e4e4;
8+
9+
color-scheme: light;
10+
}
11+
12+
:root[data-theme='dark'] {
13+
--paper: #0b0b0b;
14+
--ink: #f2f2f2;
15+
--muted: #a1a1a1;
16+
--line: #262626;
17+
18+
color-scheme: dark;
19+
}
20+
21+
@theme inline {
22+
--color-paper: var(--paper);
23+
--color-ink: var(--ink);
24+
--color-muted: var(--muted);
25+
--color-line: var(--line);
726
}
827

928
body {
1029
margin: 0;
30+
color: var(--ink);
31+
background: var(--paper);
32+
font-family: system-ui, sans-serif;
1133
}
1234

1335
a {

‎src/app.html‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,26 @@
44
<meta charset="utf-8" />
55
<meta name="viewport" content="width=device-width, initial-scale=1" />
66
<meta name="theme-color" content="#ffffff" />
7+
<script>
8+
try {
9+
const savedTheme = localStorage.getItem('theme');
10+
const theme =
11+
savedTheme === 'light' || savedTheme === 'dark'
12+
? savedTheme
13+
: matchMedia('(prefers-color-scheme: dark)').matches
14+
? 'dark'
15+
: 'light';
16+
17+
document.documentElement.dataset.theme = theme;
18+
document.documentElement.style.colorScheme = theme;
19+
document
20+
.querySelector('meta[name="theme-color"]')
21+
?.setAttribute('content', theme === 'dark' ? '#0b0b0b' : '#ffffff');
22+
} catch {
23+
// Use the light theme when browser storage is unavailable.
24+
}
25+
</script>
26+
<link rel="icon" href="%sveltekit.assets%/favicon.svg" />
727
%sveltekit.head%
828
</head>
929
<body data-sveltekit-preload-data="hover">

‎src/routes/+error.svelte‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<script lang="ts">
2+
import { page } from '$app/state';
3+
</script>
4+
5+
<svelte:head>
6+
<title>{page.status} — Example</title>
7+
</svelte:head>
8+
9+
<main class="mx-auto grid min-h-[70vh] max-w-5xl place-items-center px-6 py-24 text-center">
10+
<div>
11+
<p class="text-sm uppercase tracking-widest text-muted">Error / {page.status}</p>
12+
<h1 class="mt-6 text-5xl font-semibold tracking-tight sm:text-7xl">This path went quiet.</h1>
13+
<p class="mx-auto mt-6 max-w-md leading-relaxed text-muted">
14+
{page.error?.message ?? 'The page could not be found.'}
15+
</p>
16+
<a class="mt-9 inline-block text-sm font-semibold underline" href="/">Return home →</a>
17+
</div>
18+
</main>

‎src/routes/+layout.svelte‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,29 @@
11
<script lang="ts">
2+
import { onMount } from 'svelte';
23
import '../app.css';
34
45
let { children } = $props();
6+
7+
let theme = $state<'light' | 'dark'>('light');
8+
9+
onMount(() => {
10+
theme = document.documentElement.dataset.theme === 'dark' ? 'dark' : 'light';
11+
});
12+
13+
const toggleTheme = () => {
14+
theme = theme === 'dark' ? 'light' : 'dark';
15+
document.documentElement.dataset.theme = theme;
16+
document.documentElement.style.colorScheme = theme;
17+
document
18+
.querySelector('meta[name="theme-color"]')
19+
?.setAttribute('content', theme === 'dark' ? '#0b0b0b' : '#ffffff');
20+
21+
try {
22+
localStorage.setItem('theme', theme);
23+
} catch {
24+
// Keep the in-page theme when browser storage is unavailable.
25+
}
26+
};
527
</script>
628

729
<svelte:head>
@@ -13,4 +35,14 @@
1335
<meta property="og:url" content="https://example.com" />
1436
</svelte:head>
1537

38+
<button
39+
class="fixed right-5 top-5 z-50 rounded-full border border-line bg-paper px-4 py-2 text-xs font-semibold text-muted"
40+
type="button"
41+
data-testid="theme-toggle"
42+
aria-label="Switch to {theme === 'dark' ? 'light' : 'dark'} theme"
43+
onclick={toggleTheme}
44+
>
45+
{theme === 'dark' ? 'Light' : 'Dark'}
46+
</button>
47+
1648
{@render children()}

‎src/routes/+layout.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
export const prerender = true;
2+
export const trailingSlash = 'always';

‎src/routes/sitemap.xml/+server.ts‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import type { RequestHandler } from './$types';
2+
3+
export const prerender = true;
4+
5+
const pages = [''];
6+
7+
export const GET: RequestHandler = () => {
8+
const urls = pages.map((page) => `<url><loc>https://example.com/${page}</loc></url>`).join('');
9+
10+
return new Response(
11+
`<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">${urls}</urlset>`,
12+
{
13+
headers: {
14+
'Content-Type': 'application/xml'
15+
}
16+
}
17+
);
18+
};

‎static/favicon.svg‎

Lines changed: 13 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)