-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.eleventy.js
34 lines (30 loc) · 922 Bytes
/
.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
const { DateTime } = require("luxon");
module.exports = function (eleventyConfig) {
eleventyConfig.addWatchTarget("./src/sass/");
eleventyConfig.addPassthroughCopy("./src/assets");
eleventyConfig.addPassthroughCopy("./src/admin");
eleventyConfig.addPassthroughCopy("./src/_site.js");
eleventyConfig.setBrowserSyncConfig({
files: "./public/css/**/*.css",
});
eleventyConfig.addFilter("postDate", (dateObj) => {
return DateTime.fromJSDate(dateObj).toLocaleString(DateTime.DATE_MED);
});
//? tags
eleventyConfig.addCollection("tagsList", function (collectionApi) {
const tagsList = new Set();
collectionApi.getAll().map((item) => {
if (item.data.tags) {
// handle pages that don't have tags
item.data.tags.map((tag) => tagsList.add(tag));
}
});
return tagsList;
});
return {
dir: {
input: "src",
output: "public",
},
};
};