From faf0abbb1e6a68dc4c3713639a6ecab7afac8b55 Mon Sep 17 00:00:00 2001 From: Michal Vanko Date: Tue, 31 Jan 2023 21:23:35 +0100 Subject: [PATCH] All pages done, build successful, images not working --- package.json | 2 +- src/components/SvgIcon.svelte | 2 +- src/components/portfolio/presentation.svelte | 2 +- src/routes/+layout.ts | 3 +- src/routes/+page.svelte | 6 +-- src/routes/blog/[...params]/+page.ts | 2 +- .../blog/[slug=blogPage]/+page.server.ts | 2 + .../+server.ts | 1 + src/routes/feed.json/+server.ts | 1 + src/routes/feed.xml/+server.ts | 1 + src/routes/portfolio/+page.server.ts | 4 +- src/routes/portfolio/not-neede.ts | 9 ---- .../showcase/{index.svelte => +page.svelte} | 0 src/svg/build/icons-sprite.svg | 27 ++++++++++ static/m-wide-cam-bg.svg | 52 +++++++++++++++++++ vite.config.ts | 4 +- 16 files changed, 98 insertions(+), 20 deletions(-) rename src/routes/blog/articles/{[...params] => [...params].json}/+server.ts (95%) delete mode 100644 src/routes/portfolio/not-neede.ts rename src/routes/showcase/{index.svelte => +page.svelte} (100%) create mode 100644 src/svg/build/icons-sprite.svg create mode 100644 static/m-wide-cam-bg.svg diff --git a/package.json b/package.json index 77858c3..feb8200 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "preview": "vite preview", "start": "svelte-kit start", "test": "vitest", - "svgstore": "svgstore -o static/build/icons-sprite.svg src/svg/**.svg", + "svgstore": "svgstore -o src/svg/build/icons-sprite.svg src/svg/**.svg", "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", "lint": "prettier --plugin-search-dir . --check . && eslint .", diff --git a/src/components/SvgIcon.svelte b/src/components/SvgIcon.svelte index 61975d5..804cb48 100644 --- a/src/components/SvgIcon.svelte +++ b/src/components/SvgIcon.svelte @@ -1,5 +1,5 @@ diff --git a/src/components/portfolio/presentation.svelte b/src/components/portfolio/presentation.svelte index 2912898..71eb913 100644 --- a/src/components/portfolio/presentation.svelte +++ b/src/components/portfolio/presentation.svelte @@ -26,7 +26,7 @@
diff --git a/src/routes/+layout.ts b/src/routes/+layout.ts index 2eafda1..87798df 100644 --- a/src/routes/+layout.ts +++ b/src/routes/+layout.ts @@ -1,7 +1,8 @@ import type { LayoutLoad } from './$types' +export const prerender = true export const load = (async ({ fetch }) => { - const blogPostsResponse = await fetch(`/blog/articles/pageSize/5`) + const blogPostsResponse = await fetch(`/blog/articles/pageSize/5.json`) const blogPostsContent = await blogPostsResponse.json() return { diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index a2d4acf..a9544eb 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -21,16 +21,16 @@ Portrait diff --git a/src/routes/blog/[...params]/+page.ts b/src/routes/blog/[...params]/+page.ts index 1c9a243..3defa20 100644 --- a/src/routes/blog/[...params]/+page.ts +++ b/src/routes/blog/[...params]/+page.ts @@ -6,7 +6,7 @@ import type { PaginationResult } from '$lib/pagination/pagination' export const load = (async ({ fetch, params }) => { const { page = 1, pageSize = 7, ...filters } = parseParams(params.params) const articleResponse = await fetch( - `/blog/articles/${params.params ? params.params : 'index'}` + `/blog/articles/${params.params ? params.params : 'index'}.json` ).then((r) => r.json()) return { diff --git a/src/routes/blog/[slug=blogPage]/+page.server.ts b/src/routes/blog/[slug=blogPage]/+page.server.ts index 58096cd..2e12d01 100644 --- a/src/routes/blog/[slug=blogPage]/+page.server.ts +++ b/src/routes/blog/[slug=blogPage]/+page.server.ts @@ -6,6 +6,8 @@ import { error, json } from '@sveltejs/kit' import type { PostAttributes } from '../content' import type { PageServerLoad } from './$types' +export const prerender = true + export interface SinglePost { body: string } diff --git a/src/routes/blog/articles/[...params]/+server.ts b/src/routes/blog/articles/[...params].json/+server.ts similarity index 95% rename from src/routes/blog/articles/[...params]/+server.ts rename to src/routes/blog/articles/[...params].json/+server.ts index 450b23c..5eb2289 100644 --- a/src/routes/blog/articles/[...params]/+server.ts +++ b/src/routes/blog/articles/[...params].json/+server.ts @@ -6,6 +6,7 @@ import { json } from '@sveltejs/kit' import { getBlogListing } from '../../content' import type { RequestHandler } from './$types' +export const prerender = true export const GET = (async ({ params }) => { const handledParams = params.params === 'index' ? '' : params.params const { page = 1, pageSize = 7, ...filters } = parseParams(handledParams) diff --git a/src/routes/feed.json/+server.ts b/src/routes/feed.json/+server.ts index cf7eeb2..4186019 100644 --- a/src/routes/feed.json/+server.ts +++ b/src/routes/feed.json/+server.ts @@ -1,6 +1,7 @@ import type { RequestHandler } from '@sveltejs/kit' import { getFeed } from '../feed' +export const prerender = true export const GET = (async ({ setHeaders }) => { const feed = await getFeed() diff --git a/src/routes/feed.xml/+server.ts b/src/routes/feed.xml/+server.ts index f97c20a..7dcfa97 100644 --- a/src/routes/feed.xml/+server.ts +++ b/src/routes/feed.xml/+server.ts @@ -1,6 +1,7 @@ import type { RequestHandler } from '@sveltejs/kit' import { getFeed } from '../feed' +export const prerender = true export const GET = (async ({ setHeaders }) => { const feed = await getFeed() diff --git a/src/routes/portfolio/+page.server.ts b/src/routes/portfolio/+page.server.ts index 62d926b..e73c64e 100644 --- a/src/routes/portfolio/+page.server.ts +++ b/src/routes/portfolio/+page.server.ts @@ -5,6 +5,8 @@ import marked from 'marked' import { parseField } from '../../markdown/parse-markdown' import type { PageServerLoad } from './$types' +export const prerender = true + export interface RecordAttributes { name: string description: string @@ -78,5 +80,5 @@ export const load = (async () => { presentations, } - return response; + return response }) satisfies PageServerLoad diff --git a/src/routes/portfolio/not-neede.ts b/src/routes/portfolio/not-neede.ts deleted file mode 100644 index f7b62bf..0000000 --- a/src/routes/portfolio/not-neede.ts +++ /dev/null @@ -1,9 +0,0 @@ -import type { PageLoad } from './$types' - -export const load = (async () => { - const res = await fetch('/portfolio.json') - const content = await res.json() - return { - content, - } -}) satisfies PageLoad diff --git a/src/routes/showcase/index.svelte b/src/routes/showcase/+page.svelte similarity index 100% rename from src/routes/showcase/index.svelte rename to src/routes/showcase/+page.svelte diff --git a/src/svg/build/icons-sprite.svg b/src/svg/build/icons-sprite.svg new file mode 100644 index 0000000..a9bacec --- /dev/null +++ b/src/svg/build/icons-sprite.svg @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/static/m-wide-cam-bg.svg b/static/m-wide-cam-bg.svg new file mode 100644 index 0000000..81de0f1 --- /dev/null +++ b/static/m-wide-cam-bg.svg @@ -0,0 +1,52 @@ + + + + + + + + + + diff --git a/vite.config.ts b/vite.config.ts index be08ac2..85e0bc6 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,9 +1,9 @@ import { sveltekit } from '@sveltejs/kit/vite' -import { UserConfig } from 'vite' +import type { UserConfig } from 'vite' import { vanillaExtractPlugin } from '@vanilla-extract/vite-plugin' const config: UserConfig = { - plugins: [sveltekit(), vanillaExtractPlugin()], + plugins: [vanillaExtractPlugin(), sveltekit()], test: { include: ['src/**/*.{test,spec}.{js,ts}'], },