-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eleventy.js
47 lines (40 loc) · 1.61 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
require('dotenv').config()
const { EleventyRenderPlugin } = require('@11ty/eleventy')
const syntaxHighlight = require('@11ty/eleventy-plugin-syntaxhighlight')
const dateFormat = require('./src/_filters/date')
const absoluteUrl = require('./src/_filters/absoluteUrl')
const stringify = require('./src/_filters/stringify')
const { number, miles, percent, max } = require('./src/_filters/numbers')
module.exports = config => {
config.addPlugin(syntaxHighlight)
config.addPlugin(EleventyRenderPlugin)
config.addShortcode('svg', async function (filename, options = {}) {
const { renderFile } = config.javascriptFunctions
return await renderFile(`./src/icons/${filename}.svg`, options, 'njk')
})
config.addFilter('dateFormat', dateFormat)
config.addFilter('absoluteUrl', absoluteUrl)
config.addFilter('stringify', stringify)
config.addFilter('formattedNumber', number)
config.addFilter('miles', miles)
config.addFilter('percent', percent)
config.addFilter('max', max)
config.addFilter('dateSlug', date => {
return dateFormat(date, { year: 'numeric', month: 'numeric', day: 'numeric' }).split('/').reverse().join('-')
})
config.addPassthroughCopy('CNAME')
config.addPassthroughCopy({
'node_modules/prismjs/themes/prism-okaidia.min.css': 'css/prism-theme.css',
'node_modules/@trovster/fitness-visualisations/src/FitnessCard.js': 'js/FitnessCard.js',
'node_modules/@trovster/fitness-visualisations/src/FitnessRing.js': 'js/FitnessRing.js'
})
return {
dir: {
input: 'src',
output: 'dist',
data: '_data',
includes: '_includes',
layouts: '_layouts'
}
}
}