-
Notifications
You must be signed in to change notification settings - Fork 1
/
svelte.config.js
51 lines (42 loc) · 999 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
import preprocess from "svelte-preprocess";
import cf_adapter from "@sveltejs/adapter-cloudflare";
import static_adapter from "@sveltejs/adapter-static";
import node_adapter from "@sveltejs/adapter-node";
let adapter;
switch (process.env.DEPLOY_TARGET) {
case "cloudflare":
adapter = cf_adapter();
break;
case "static":
adapter = static_adapter({ fallback: "200.html" });
break;
case "node":
adapter = node_adapter({ precompress: true });
break;
default:
adapter = static_adapter({ fallback: "200.html" });
}
const get_css_hash = ({ css, hash }) => {
return `css-${hash(css)}`;
};
/** @type {import('@sveltejs/kit').Config} */
const config = {
preprocess: [
preprocess({
postcss: true,
}),
],
compilerOptions: {
cssHash: get_css_hash,
},
kit: {
adapter,
alias: {
$src: "src",
$components: "src/lib/components",
},
trailingSlash: "always",
inlineStyleThreshold: 1024 * 16, // inline css files smaller than 16 kb
},
};
export default config;