-
Notifications
You must be signed in to change notification settings - Fork 1
/
.eleventy.js
39 lines (32 loc) · 1018 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
35
36
37
38
39
const pluginBookshop = require("@bookshop/eleventy-bookshop");
const { DateTime } = require("luxon");
module.exports = function (eleventyConfig) {
// Hot reloading for local dev
eleventyConfig.setBrowserSyncConfig({
files: './_site/**/*.*'
});
// Display the current year
eleventyConfig.addShortcode("year", () => `${new Date().getFullYear()}`);
// Find the length of an array
eleventyConfig.addFilter("length", (input) => {
return input.length;
});
// Using Luxon for date formatting
eleventyConfig.addFilter("postDate", (dateObj) => {
return DateTime.fromJSDate(dateObj).toLocaleString(DateTime.DATE_MED);
});
// What gets passed through to the built site
eleventyConfig.ignores.add("src/schemas");
eleventyConfig.addPassthroughCopy("src/images");
// Bookshop integration
eleventyConfig.addPlugin(pluginBookshop({
bookshopLocations: ["component-library"],
pathPrefix: '',
}));
return {
dir: {
input: "src",
pages: "pages",
},
};
};