generated from Spenhouet/svelte-gh-pages-quickstart
-
Notifications
You must be signed in to change notification settings - Fork 1
/
svelte.config.js
73 lines (67 loc) · 1.67 KB
/
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import adapter from '@sveltejs/adapter-static';
import { vitePreprocess } from '@sveltejs/kit/vite';
import fs from 'fs';
// import glob from 'glob';
const assets = fs.readdirSync('./assets');
const issuers = fs.readdirSync('./issuers');
const chains = fs.readdirSync('./chains');
// const tokens = glob
// .sync('./assets/*/contracts.json')
// .map((filePath) => JSON.parse(fs.readFileSync(filePath, 'utf-8')))
// .map((contracts) => contracts.token.address)
/** @type {import('@sveltejs/kit').Config} */
const config = {
preprocess: [
// Consult https://kit.svelte.dev/docs/integrations#preprocessors
// for more information about preprocessors
vitePreprocess({
scss: {
prependData: '@use "src/variables.scss" as *;'
},
postcss: true,
preserve: ['ld+json']
})
],
kit: {
alias: {
$components: 'src/components',
$api: 'src/routes/(api)',
$pre: 'src/preprocess',
},
paths: {
base: '',
},
adapter: adapter({
pages: 'build',
assets: 'build',
fallback: '404.html',
precompress: false
}),
prerender: {
entries: [
'*',
'/',
...assets.map((id) => `/assets/${id}/icon.svg`),
'/site.webmanifest',
'/sitemap.xml',
'/faq',
'/about',
'/legal-notice',
'/graph',
'/assets',
'/issuers',
'/chains',
// '/assets.json',
// ...assets.map((id) => `/assets/${id}.json`),
...assets.map((id) => `/assets/${id}`),
...issuers.map((id) => `/issuers/${id}`),
...chains.map((id) => `/chains/${id}`),
// '/trees.json',
// '/graph.json',
// ...assets.map((id) => `/trees/${id}.json`),
// ...tokens.map((id) => `/tokens/${id}.json`),
],
},
},
};
export default config;