generated from Spenhouet/svelte-gh-pages-quickstart
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsvelte.config.js
52 lines (44 loc) · 987 Bytes
/
svelte.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import fs from 'fs';
import preprocess from 'svelte-preprocess';
import adapter from '@sveltejs/adapter-static';
// TODO copy icons to static folder
const chainIds = fs.readdirSync(`./chains`, { withFileTypes: true })
.filter(dirent => dirent.isDirectory())
.map(dirent => +dirent.name);
const TARGET = process.env.npm_lifecycle_event;
/** @type {import('@sveltejs/kit').Config} */
const config = {
kit: {
paths: {
base: TARGET === 'dev' ? '' : '/chains',
},
adapter: adapter({
pages: 'build',
assets: 'build',
fallback: 'index.html',
precompress: false
}),
prerender: {
enabled: true,
entries: [
'*',
'/',
...chainIds.map((id) => `/${id}.json`),
'/chains.json',
'/chains.min.json',
'/chains-full.json',
'/chains-full.min.json'
]
},
},
preprocess: [
preprocess({
scss: {
prependData: '@use "src/variables.scss" as *;'
},
postcss: true,
preserve: ['ld+json']
})
]
};
export default config;