-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eleventy.js
38 lines (33 loc) · 988 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
const fs = require("fs");
const faviconPlugin = require("eleventy-favicon");
const eleventySass = require("@grimlink/eleventy-plugin-sass");
const sass = require("sass");
module.exports = function (eleventyConfig) {
this.returnOptions = {
dir: {
input: "src",
output: "build",
data: "_data"
}
};
eleventyConfig.addPlugin(faviconPlugin, { destination: "build" });
eleventyConfig.addPlugin(eleventySass, { sass, outputPath: null });
eleventyConfig.addPassthroughCopy("./src/assets/");
eleventyConfig.addWatchTarget("./src/assets/");
loadConfigModules(eleventyConfig);
return this.returnOptions;
};
function loadConfigModules(eleventyConfig) {
const paths = fs.readdirSync("./_config/");
for (const p in paths) {
const path = paths[p];
if (!path.endsWith(".js")) {
return;
}
const _module = require("./_config/" + path);
const options = _module(eleventyConfig);
if (options) {
this.returnOptions = { ...this.returnOptions, ...options };
}
}
}