-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.eleventy.cjs
executable file
·68 lines (54 loc) · 1.86 KB
/
.eleventy.cjs
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
const filters = require('./utils/filters.cjs')
const transforms = require('./utils/transforms.cjs')
const collections = require('./utils/collections.cjs')
const markdownIt = require('markdown-it');
const syntaxHighlight = require('@11ty/eleventy-plugin-syntaxhighlight');
module.exports = function (eleventyConfig) {
// Folders to copy to build dir (See. 1.1)
eleventyConfig.addPassthroughCopy("src/static");
eleventyConfig.addPassthroughCopy('src/assets/scripts');
// Filters
Object.keys(filters).forEach((filterName) => {
eleventyConfig.addFilter(filterName, filters[filterName])
})
// Transforms
Object.keys(transforms).forEach((transformName) => {
eleventyConfig.addTransform(transformName, transforms[transformName])
})
// Collections
Object.keys(collections).forEach((collectionName) => {
eleventyConfig.addCollection(collectionName, collections[collectionName])
})
// This allows Eleventy to watch for file changes during local development.
eleventyConfig.setUseGitIgnore(false);
// Get released articles only
eleventyConfig.addCollection("releasedArticles", function(collectionApi) {
return collectionApi.getFilteredByTag("article").filter(p => {
let now = new Date().getTime();
return now >= p.date.getTime();
});
});
eleventyConfig.addPlugin(syntaxHighlight);
eleventyConfig.addLayoutAlias('contact', '_layouts/contact.njk');
eleventyConfig.addLayoutAlias('about', '_layouts/about.njk');
let options = {
html: true,
breaks: false,
linkify: true,
langPrefix: "language-",
};
eleventyConfig.setLibrary("md", markdownIt(options));
return {
dir: {
input: "src",
output: "dist",
includes: "_includes",
layouts: "_layouts"
},
templateFormats: ["html", "md", "njk"],
htmlTemplateEngine: "njk",
markdownTemplateEngine: "njk",
// 1.1 Enable eleventy to pass dirs specified above
passthroughFileCopy: true
};
};