/
.eleventy.js
58 lines (37 loc) · 1.05 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
const pluginSass = require("eleventy-plugin-sass");
module.exports = function(config){
config.addShortcode("log", function (data) {
console.log(data);
});
config.addFilter("convertTimestamp", function(raceDate){
return Date.parse(raceDate);
});
config.addShortcode("formatDate", function(raceDate) {
const months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
const raceUTC = new Date(raceDate)
return months[raceUTC.getMonth()] + ' ' + raceUTC.getDate() + ', ' + raceUTC.getFullYear()
});
config.addShortcode("constructorsList", function(c) {
let cList = [];
c.forEach(function(c){
cList.push('<a href="'+ c.url +'">'+ c.name +'</a>');
});
return cList.join(', ');
});
config.addPlugin(pluginSass, {
outputDir: ''
});
config.addPassthroughCopy("images");
config.addPassthroughCopy("js");
config.addPassthroughCopy("fonts");
return {
dir: {
input: "src",
output: "dist"
},
templateFormats: [
'md',
'njk'
]
}
};