Skip to content

Commit

Permalink
Separate dev routes from routes
Browse files Browse the repository at this point in the history
  • Loading branch information
BenCheung0422 committed Jul 6, 2024
1 parent d298b68 commit 522991c
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 29 deletions.
29 changes: 29 additions & 0 deletions src/dev/+error.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<script lang="ts">
import { page } from '$app/stores';
import { base } from "$app/paths";
export let msg = $page.error!.message;
export let status = $page.status.toString();
</script>

<div class="flex flex-col h-screen">
<!-- Reference: https://tailwindcomponents.com/component/simple-404-page-template -->
<div class="flex items-center justify-center bg-green-400 py-48">
<div class="flex flex-col">
<div class="flex flex-col items-center">
<div class="text-green-700 font-bold text-7xl">
{status}
</div>

<div class="font-bold text-3xl xl:text-7xl lg:text-6xl md:text-5xl mt-10">
{msg}
</div>
</div>
</div>
</div>

<footer class="bg-green-200" aria-labelledby="footer-heading">
<div class="flex p-12 flex-col items-center m-auto px-6 text-3xl">
<a href="{base}/">Go back to home</a>
</div>
</footer>
</div>
1 change: 1 addition & 0 deletions src/dev/+layout.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const prerender = true;
File renamed without changes.
3 changes: 2 additions & 1 deletion src/routes/dev/+layout.svelte → src/dev/+layout.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<script>
import "../app.css";
import "./+layout.scss";
</script>

Expand Down Expand Up @@ -28,7 +29,7 @@
</button>
</div>
<div class="flex flex-1 items-center justify-center sm:items-stretch sm:justify-start">
<a href="/" class="flex flex-shrink-0 items-center mr-4">
<a href="/static" class="flex flex-shrink-0 items-center mr-4">
<img class="h-8 w-auto" src="" alt="Minicraft+">
</a>
<div class="hidden sm:ml-6 sm:block">
Expand Down
File renamed without changes.
File renamed without changes.
5 changes: 0 additions & 5 deletions src/routes/404/+page.svelte

This file was deleted.

21 changes: 0 additions & 21 deletions src/routes/dev/+layout.js

This file was deleted.

6 changes: 4 additions & 2 deletions svelte.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@ import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
const config = {
kit: {
adapter: adapter({
// fallback: '404.html',
fallback: '404.html',
pages: './build',
assets: './build',
// strict: true
}),
paths: {
base: process.argv.includes('dev') ? '' : process.env.BASE_PATH
},
files: {
routes: process.argv.includes('dev') ? "src/dev" : "src/routes",
}
},
preprocess: vitePreprocess()
};
Expand Down

0 comments on commit 522991c

Please sign in to comment.