-
Notifications
You must be signed in to change notification settings - Fork 0
/
svelte.config.js
48 lines (45 loc) · 1.06 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
import adapter from '@sveltejs/adapter-vercel';
import remarkHeadings from '@sveltinio/remark-headings';
import { mdsvex } from 'mdsvex';
import rehypeAutolinkHeadings from 'rehype-autolink-headings';
import rehypeSlug from 'rehype-slug';
/**
* @type {import('@sveltejs/kit').Config}
*/
const config = {
extensions: ['.svelte', '.mdx'],
preprocess: [
csslayer(),
mdsvex({
extension: 'mdx',
rehypePlugins: [rehypeSlug, [rehypeAutolinkHeadings, { behavior: 'wrap' }]],
remarkPlugins: [remarkHeadings],
}),
],
kit: {
adapter: adapter(),
alias: {
$i18n: 'src/lib/i18n/generated',
$content: 'src/content',
},
},
compilerOptions: {
cssHash: (styles) => `nplex-${styles.hash(styles.css)}`, // Only applies to prod.
},
};
export default config;
/**
* Scoping component styles to a predefined layer to control cascade ordering.
*
* @see https://github.com/sveltejs/svelte/issues/11345
*/
function csslayer() {
return {
name: 'svelte-css-layer',
style: ({ content }) => {
return {
code: `@layer components { ${content} }`,
};
},
};
}