-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathulka-config.js
54 lines (50 loc) · 1.36 KB
/
ulka-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
const path = require('path')
const { defineConfig, slugify } = require('ulka')
const anchor = require('markdown-it-anchor')
const shikiPlugin = require('./plugins/shikiPlugin')
module.exports = defineConfig(async (ulka) => {
const md = ulka.engines['.md'].md
md.set({ html: true }).use(anchor, { slugify })
return {
metaData: {
domain: 'https://ulka.js.org',
},
input: 'src',
output: 'dist',
layout: path.join('src', 'layouts'),
concurrency: Infinity,
plugins: [shikiPlugin],
contents: {
main: {
match: ['index.ulka'],
},
others: {
match: ['sitemap.xml.ulka'],
},
docs: content(ulka, 'docs/**.md'),
plugins: content(ulka, 'plugins/**.md'),
},
copy: [
'assets/**',
{
match: 'static/{**,.**}/**',
output: (p) => {
const pth = path.relative(path.join(ulka.configs.output, 'static'), p)
return path.join(ulka.configs.output, pth)
},
},
],
}
})
const content = (ulka, match) => {
return {
match,
layout: 'docs.ulka',
sort: (a, b) => a.context.matter.page - b.context.matter.page,
forEach(temp) {
const base = `https://github.com/ulkajs/ulkajs.github.io/blob/main/src/`
const rel = path.relative(ulka.configs.input, temp.fileinfo.filepath)
temp.context.githubLink = base + rel
},
}
}