-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eleventy.js
43 lines (37 loc) · 1.17 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
const { EleventyHtmlBasePlugin } = require('@11ty/eleventy');
module.exports = function(eleventyConfig) {
eleventyConfig.addPlugin(EleventyHtmlBasePlugin);
eleventyConfig.addPassthroughCopy('./src/styles');
eleventyConfig.addPassthroughCopy('./src/scripts');
eleventyConfig.addPassthroughCopy('./src/images');
eleventyConfig.addPassthroughCopy('./src/CNAME');
eleventyConfig.addWatchTarget('./src/styles');
eleventyConfig.addWatchTarget('./src/scripts');
eleventyConfig.addWatchTarget('./src/images');
eleventyConfig.addFilter('formatDate', dateString => {
const date = new Date(dateString);
return date.toLocaleString('en-US', {
dateStyle: "full",
timeStyle: "short"
});
});
eleventyConfig.addFilter('isUpcoming', dateString => {
const date = new Date(dateString);
return date >= new Date();
});
eleventyConfig.addFilter('upcomingCount', shows => {
const now = new Date();
const upcoming = shows.filter(show => {
const date = new Date(show.date);
return date >= now;
});
return upcoming.length;
});
return {
// pathPrefix: '//',
dir: {
input: 'src',
output: 'dist'
}
};
};