-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eleventy.js
64 lines (57 loc) · 1.75 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
var { documentToHtmlString } = require('@contentful/rich-text-html-renderer')
var sortByIndex = values => {
let vals = [...values]
return vals.sort((a, b) => Math.sign(a.data.index - b.data.index))
}
var markedParse = array =>{
return documentToHtmlString (array)
}
var gameFaqSort = array =>{
itemsWithIndex = array.filter(a=>a.index)
itemsWithoutIndex = array.filter(a=>!a.index)
itemsWithoutIndexSorted = itemsWithoutIndex.sort((a, b) => a.question.localeCompare(b.question))
newArray = []
itemsWithIndex.forEach(i=>{
if(i.index == 1)
newArray.push(i)
})
newArray.push(itemsWithoutIndexSorted)
itemsWithIndex.forEach(i=>{
if(i.index == -1)
newArray.push(i)
})
flatArray = newArray.flat()
return flatArray
}
var faqSort = array =>{
itemsWithIndex = array.filter(a=>a.index)
itemsWithoutIndex = array.filter(a=>!a.index)
newArray = []
itemsWithIndex.forEach(i=>{
if(i.index == 1)
newArray.push(i)
})
newArray.push(itemsWithoutIndex)
itemsWithIndex.forEach(i=>{
if(i.index == -1)
newArray.push(i)
})
flatArray = newArray.flat()
return flatArray
}
module.exports = eleventyConfig => {
eleventyConfig.addFilter('sortByIndex', sortByIndex)
eleventyConfig.addFilter('gameFaqSort', gameFaqSort)
eleventyConfig.addFilter('faqSort', faqSort)
eleventyConfig.addFilter('marked', markedParse)
eleventyConfig.addPassthroughCopy('./src/styles')
eleventyConfig.addPassthroughCopy('./src/js')
eleventyConfig.addPassthroughCopy('./src/img')
eleventyConfig.addPassthroughCopy('./_redirects')
return {
dir: {
input: "src",
output: "dist"
}
}
}