-
Notifications
You must be signed in to change notification settings - Fork 219
/
svelte.config.js
58 lines (55 loc) · 1.57 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
import path from 'node:path';
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
import adapter from '@sveltejs/adapter-auto';
import hljs from 'highlight.js';
import { mdsvex, escapeSvelte } from 'mdsvex';
import rehypeSlug from 'rehype-slug';
const extensions = [`.svelte`, '.md', `.mdx`, '.svx'];
/** @type {import('@sveltejs/kit').Config} */
const config = {
preprocess: [
mdsvex({
// Breaks svelte-select when .svelte extension is included
extensions: extensions.filter((ext) => ext !== '.svelte'),
layout: {
eventPage: './src/lib/layouts/EventPage.svelte',
recipe: './src/lib/layouts/Recipe.svelte',
recipeCategory: './src/lib/layouts/RecipeCategory.svelte'
},
highlight: {
highlighter: (code) => {
const highlighted = escapeSvelte(hljs.highlightAuto(code).value);
return `{@html \`<pre class="hljs"><code>${highlighted}</code></pre>\`}`;
}
},
rehypePlugins: [rehypeSlug]
}),
vitePreprocess()
],
extensions: extensions,
kit: {
adapter: adapter(),
alias: {
$components: path.resolve('./src/lib/components'),
$layouts: path.resolve('./src/lib/layouts'),
$utils: path.resolve('./src/lib/utils'),
$styles: path.resolve('./src/lib/styles'),
$stores: path.resolve('./src/lib/stores')
},
typescript: {
config: (config) => {
config.include = [
...config.include,
'../scripts/**/*.js',
'../.eslintrc.cjs',
'../postcss.config.js',
'../prettier.config.js',
'../svelte.config.js',
'../tailwind.config.cjs'
];
return config;
}
}
}
};
export default config;