-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eleventy.js
136 lines (123 loc) · 3.72 KB
/
.eleventy.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
const fs = require('fs');
const EleventyVitePlugin = require('@11ty/eleventy-plugin-vite');
const {
makeVespers,
makeMatins,
makeLitugy,
makeHourly,
} = require('./katameros-preparation/utils/readings-repository.js');
const {
createArticleAccordions,
} = require('./katameros-preparation/utils/article-helpers');
module.exports = function (config) {
config.setLiquidOptions({
dynamicPartials: true,
});
config.addPlugin(EleventyVitePlugin);
// Static assets to pass through
config.addPassthroughCopy('./src/images');
config.addPassthroughCopy('./src/public');
config.addPassthroughCopy('./src/styles');
config.addPassthroughCopy('./src/utils');
config.addPassthroughCopy('./src/main.js');
config.addShortcode(
'makeVespers',
async function (psalmRef, gospelRef, prophecyRef) {
return makeVespers(psalmRef, gospelRef, prophecyRef);
},
);
config.addShortcode(
'makeMatins',
async function (psalmRef, gospelRef, prophecyRef) {
return makeMatins(psalmRef, gospelRef, prophecyRef);
},
);
config.addShortcode(
'makeLitugy',
async function (paulineRef, catholicRef, actsRef, psalmRef, gospelRef) {
return makeLitugy(paulineRef, catholicRef, actsRef, psalmRef, gospelRef);
},
);
config.addShortcode(
'makeHour',
async function (
psalmRef,
gospelRef,
prophecyRef1,
prophecyRef2,
prophecyRef3,
) {
return makeHourly(
psalmRef,
gospelRef,
prophecyRef1,
prophecyRef2,
prophecyRef3,
);
},
);
config.addPairedShortcode(
'createArticleAccordions',
async function (content) {
return await createArticleAccordions(content);
},
);
function filterByMonth(values, month) {
let vals = [...values];
return vals.filter((item) => {
const itemMonth = item.inputPath.split('/').pop();
const aNum = parseInt(itemMonth.split('-')[0]);
return aNum === month;
});
}
config.addFilter('filterByMonth', filterByMonth);
function filterByIntro(values, articles) {
let vals = [...values];
return vals.filter((item) => {
const itemUrl = item.url.split('/').pop();
const aNum = parseInt(itemUrl.split('.')[0]);
return articles.includes(aNum);
});
}
config.addFilter('filterByIntro', filterByIntro);
['special', 'sundays', 'annual', 'great-lent', 'pentecost'].forEach((cat) => {
config.addCollection(cat, function (collectionApi) {
return collectionApi.getFilteredByTag(cat);
});
});
config.setServerOptions({
// Default values are shown:
// Whether the live reload snippet is used
liveReload: true,
// Whether DOM diffing updates are applied where possible instead of page reloads
domDiff: true,
// The starting port number
// Will increment up to (configurable) 10 times if a port is already in use.
port: 8080,
// Additional files to watch that will trigger server updates
// Accepts an Array of file paths or globs (passed to `chokidar.watch`).
// Works great with a separate bundler writing files to your output folder.
// e.g. `watch: ["_site/**/*.css"]`
watch: [],
// Show local network IP addresses for device testing
showAllHosts: false,
// Use a local key/certificate to opt-in to local HTTP/2 with https
https: {
// key: "./localhost.key",
// cert: "./localhost.cert",
},
// Change the default file encoding for reading/serving files
encoding: 'utf-8',
});
return {
dir: {
input: 'src',
output: '_site',
},
passthroughFileCopy: true,
templateFormats: ['html', 'md', 'liquid'],
htmlTemplateEngine: 'liquid',
dataTemplateEngine: 'liquid',
markdownTemplateEngine: 'liquid',
};
};