forked from jordimarimon/ts-ast-parser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eleventy.cjs
64 lines (51 loc) · 2.17 KB
/
.eleventy.cjs
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
const syntaxHighlight = require('@11ty/eleventy-plugin-syntaxhighlight');
const esBuildPlugin = require('./scripts/build-docs.cjs');
const {DateTime} = require('luxon');
module.exports = (eleventyConfig) => {
// Adds the following files in the bundle
eleventyConfig.addPassthroughCopy('docs/favicon.ico');
eleventyConfig.addPassthroughCopy({'docs/robots.txt': '/robots.txt'});
eleventyConfig.addPassthroughCopy({
'node_modules/jsoneditor/dist/img/jsoneditor-icons.svg': '/assets/css/img/jsoneditor-icons.svg',
});
// Make sure the nav items are ordered correctly
eleventyConfig.addCollection('page', (collections) => {
return collections.getFilteredByTag('page').sort((a, b) => {
return a.data.order - b.data.order;
});
});
eleventyConfig.addCollection('core', (collections) => {
return collections.getFilteredByTag('core').sort((a, b) => {
return a.data.order - b.data.order;
});
});
eleventyConfig.addCollection('readers', (collections) => {
return collections.getFilteredByTag('readers').sort((a, b) => {
return a.data.order - b.data.order;
});
});
// Transform the name of a module into the name of a collection
eleventyConfig.addFilter("makeCollectionName", (value) => {
return String(value).split(/\s|-/).map((v, i) => {
return (i === 0 ? v[0].toLowerCase() : v[0].toUpperCase()) + v.slice(1);
}).join('');
});
// Syntax highlighting: https://www.11ty.dev/docs/plugins/syntaxhighlight/
eleventyConfig.addPlugin(syntaxHighlight);
// For the sitemap
eleventyConfig.addShortcode('currentDate', () => DateTime.now());
// Bundles JS files
eleventyConfig.addPlugin(esBuildPlugin);
return {
dir: {
input: 'docs',
output: '_site',
data: '_data',
includes: '_includes',
layouts: '_layouts',
},
templateFormats: ['njk', 'md', 'html'],
// The public documentation URL is: https://<user>.github.io/<repository-name>/
pathPrefix: process.env.NODE_ENV === 'production' ? '/ts-ast-parser/' : '/',
};
};