Skip to content

Commit 66a5a50

Browse files
committed
use svelte-adapter-ghpages
1 parent eaac8c8 commit 66a5a50

File tree

4 files changed

+14
-17
lines changed

4 files changed

+14
-17
lines changed

docs/404.svelte

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1+
<script>
2+
import { base as baseUrl } from "$app/paths"
3+
</script>
4+
15
<h1>404</h1>
26
<blockquote>
37
<p>Not Found</p>
4-
<p>Take me <a href="/eslint-plugin-svelte/">home</a></p>
8+
<p>Take me <a href="{baseUrl}/">home</a></p>
59
</blockquote>
610

711
<style>

docs/__error.svelte

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@
88
</script>
99

1010
<script>
11+
import { base as baseUrl } from "$app/paths"
1112
export let status, error
1213
</script>
1314

1415
<h1>{status}</h1>
1516
<blockquote>
1617
<p>{error.message}</p>
17-
<p>Take me <a href="/eslint-plugin-svelte/">home</a></p>
18+
<p>Take me <a href="{baseUrl}/">home</a></p>
1819
</blockquote>

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@
118118
"stylelint": "^14.0.0",
119119
"stylelint-config-standard": "^24.0.0",
120120
"svelte": "^3.37.0",
121+
"svelte-adapter-ghpages": "0.0.1",
121122
"ts-node": "^10.0.0",
122123
"typescript": "^4.5.2",
123124
"vite-plugin-svelte-md": "^0.1.3",

svelte.config.esm.mjs

+6-15
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* global __dirname -- __dirname */
2-
import staticAdapter from "@sveltejs/adapter-static"
2+
import ghpagesAdapter from "svelte-adapter-ghpages"
33
import path from "path"
44
import svelteMd from "vite-plugin-svelte-md"
55
import svelteMdOption from "./docs-svelte-kit/tools/vite-plugin-svelte-md-option.mjs"
@@ -14,11 +14,6 @@ const dirname =
1414
return path.dirname(new URL(metaUrl).pathname)
1515
})()
1616

17-
const baseStaticAdapter = staticAdapter({
18-
// default options are shown
19-
pages: "build",
20-
assets: "build",
21-
})
2217
/** @type {import('@sveltejs/kit').Config} */
2318
const config = {
2419
compilerOptions: {
@@ -29,15 +24,11 @@ const config = {
2924
paths: {
3025
base: "/eslint-plugin-svelte",
3126
},
32-
adapter: {
33-
name: baseStaticAdapter.name,
34-
35-
async adapt(arg) {
36-
await baseStaticAdapter.adapt(arg)
37-
arg.utils.copy("build/404/index.html", "build/404.html")
38-
arg.utils.rimraf("build/404")
39-
},
40-
},
27+
adapter: ghpagesAdapter({
28+
// default options are shown
29+
pages: "build",
30+
assets: "build",
31+
}),
4132

4233
// hydrate the <div id="svelte"> element in src/app.html
4334
target: "#svelte",

0 commit comments

Comments
 (0)