-
Notifications
You must be signed in to change notification settings - Fork 3
/
.eleventy.js
147 lines (122 loc) · 4.53 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
137
138
139
140
141
142
143
144
145
146
147
const filters = require('./lib/filters');
const asyncFilters = require('./lib/async-filters');
const collections = require('./lib/collections');
const {slugify} = require('./lib/filters');
const shortcodes = require('./lib/shortcodes');
const transforms = require('./lib/transforms');
const ObjectCache = require("./lib/helpers/cache");
module.exports = function (eleventyConfig) {
eleventyConfig.setUseGitIgnore(false);
//
// Install Plugins
//
eleventyConfig.addPlugin(require('@rknightuk/eleventy-plugin-post-graph'), {
boxColor: 'var(--background-muted)',
highlightColor: 'var(--accent)',
textColor: 'var(--foreground)',
});
eleventyConfig.addPlugin(require('./lib/helpers/screenshot'));
eleventyConfig.addPlugin(require('@photogabble/eleventy-plugin-interlinker'), {
defaultLayout: 'layouts/embed.liquid',
});
eleventyConfig.addPlugin(require('@photogabble/eleventy-plugin-font-subsetting'), {
srcFiles: [
`./public/fonts/iosevka-etoile-regular.woff2`,
`./public/fonts/iosevka-etoile-italic.woff2`,
`./public/fonts/iosevka-etoile-bold.woff2`,
`./public/fonts/iosevka-etoile-bolditalic.woff2`,
],
dist: './src/fonts',
enabled: process.env.ELEVENTY_ENV !== 'production',
cache: new ObjectCache('font-subsetting'),
});
eleventyConfig.addPlugin(require('@photogabble/eleventy-plugin-tag-normaliser'), {
ignore: ['PHP', 'JavaScript', 'DOScember'],
similar: {
'Game Development': ['GameDev'],
'Retro Computing': ['RetroComputing'],
'Node JS': ['Node'],
'365 Day Project': ['365DayProject']
},
slugify,
});
eleventyConfig.addPlugin(require("eleventy-plugin-postcss"));
eleventyConfig.addPlugin(require('@photogabble/eleventy-plugin-blogtimes'), {
generateHTML: (outputUrl, options) => `<img alt="Blogtimes histogram" width="${options.width}" height="${options.height}" src="${outputUrl}" style="min-width: auto;" />`,
lastXDays: 180,
});
const numberFormat = new Intl.NumberFormat('en-GB');
eleventyConfig.addPlugin(require('@photogabble/eleventy-plugin-word-stats'), {
output: (stats) => {
const words = numberFormat.format(stats.words);
return {
words: stats.words,
time: stats.text,
text: `~${words} words, about a ${stats.text}`
};
}
});
eleventyConfig.addPlugin(require("@11ty/eleventy-plugin-rss"));
eleventyConfig.addPlugin(require("@11ty/eleventy-plugin-syntaxhighlight"), {
init: ({Prism}) => {
require('prismjs/plugins/treeview/prism-treeview.js')
require('prismjs/components/prism-clike')
require('prismjs/components/prism-markup')
require('prismjs/components/prism-markup-templating')
require('prismjs/components/prism-ini')
require('prismjs/components/prism-css')
require('prismjs/components/prism-bash')
require('prismjs/components/prism-powershell')
require('prismjs/components/prism-yaml')
require('prismjs/components/prism-javascript')
require('prismjs/components/prism-sql')
require('prismjs/components/prism-twig')
require('prismjs/components/prism-php')
require('prismjs/components/prism-php-extras')
require('prismjs/components/prism-markdown')
require('prismjs/components/prism-basic')
require('prismjs/components/prism-go')
require('prismjs/components/prism-regex')
}
});
//
// Filters, Collections, Transformers and Shortcodes
//
Object.keys(filters).forEach((filterName) => {
eleventyConfig.addFilter(filterName, filters[filterName])
});
Object.keys(asyncFilters).forEach((filterName) => {
eleventyConfig.addAsyncFilter(filterName, asyncFilters[filterName]);
});
for (const [name, collection] of Object.entries(collections(eleventyConfig))) {
eleventyConfig.addCollection(name, collection);
}
Object.keys(transforms).forEach((transformName) => {
eleventyConfig.addTransform(transformName, transforms[transformName])
});
Object.keys(shortcodes).forEach((shortCodeName) => {
eleventyConfig.addShortcode(shortCodeName, shortcodes[shortCodeName]);
});
//
// Pass through
//
eleventyConfig.addPassthroughCopy({
'public/favicon': '/',
'public/files': 'files',
'public/img': 'img',
'public/sounds': 'sounds',
'_redirects': '_redirects',
'public/og-image': 'img/og-image',
'public/main.js': 'main.js',
});
//
// Markdown-It && Plugins
//
eleventyConfig.setLibrary('md', require('./lib/helpers/markdown'));
return {
dir: {
input: "src",
output: "_site"
}
};
};