-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsvelte.config.js
69 lines (65 loc) · 1.8 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
import adapter from '@sveltejs/adapter-static';
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
import sveltePreprocess from 'svelte-preprocess';
import { mdsvex } from 'mdsvex';
import path from 'path';
import rehypeRewrite from 'rehype-rewrite';
/** @type {import('mdsvex').MdsvexOptions} */
const mdsvexOptions = {
extensions: ['.md'],
rehypePlugins: [
[
rehypeRewrite,
{
rewrite: (node) => {
// replace img tags with enhanced:img
if (node.type == 'element' && node.tagName == 'img') {
node.tagName = 'enhanced:img';
// add a css class "post-img" for styling purposes
node.properties['class'] = `post-img ${node.properties['class'] ?? ''}`.trimEnd();
}
}
}
]
]
};
/** @type {import('@sveltejs/kit').Config} */
const config = {
// Consult https://kit.svelte.dev/docs/integrations#preprocessors
// for more information about preprocessors
preprocess: [
mdsvex(mdsvexOptions),
vitePreprocess(),
sveltePreprocess({ scss: true, pug: true })
],
onwarn: (warning, handler) => {
if (
warning.code === 'css-unused-selector' ||
warning.code === 'vite-plugin-svelte-preprocess-many-dependencies' ||
warning.code === 'a11y-no-redundant-roles' ||
warning.code === 'a11y-missing-content' ||
warning.code === 'a11y-img-redundant-alt' ||
warning.code === 'a11y-img-missing-alt' ||
warning.code === 'a11y-no-noninteractive-tabindex'
) {
return;
}
handler(warning);
},
extensions: ['.svelte', '.md'],
kit: {
// adapter-static is suitable for static site generation
adapter: adapter({
// default options are suitable for most applications
}),
alias: {
$content: path.resolve('content')
},
prerender: {
origin: 'https://www.yeptrainingen.nl',
entries: ['*', '/en'],
crawl: true
}
}
};
export default config;