generated from chrissy-dev/eleventy-web-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eleventy.js
executable file
·48 lines (40 loc) · 1.3 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
const filters = require('./utils/filters.js')
const transforms = require('./utils/transforms.js')
const collections = require('./utils/collections.js')
const { DateTime } = require('luxon');
module.exports = function (eleventyConfig) {
// Folders to copy to build dir (See. 1.1)
eleventyConfig.addPassthroughCopy("src/static");
// 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);
// Luxon date formatting filter
eleventyConfig.addFilter('formatDate', (dateObj) => {
return DateTime.fromJSDate(dateObj, { zone: 'utc' }).toFormat(
'MMMM d, yyyy'
);
});
return {
dir: {
input: "src/",
output: "dist",
includes: "_includes",
layouts: "_layouts"
},
templateFormats: ["html", "md", "njk"],
htmlTemplateEngine: "njk",
// 1.1 Enable eleventy to pass dirs specified above
passthroughFileCopy: true
};
};