generated from 5t3ph/11ty-sass-skeleton
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy path.eleventy.js
34 lines (29 loc) · 980 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 syntaxHighlight = require("@11ty/eleventy-plugin-syntaxhighlight");
const snippetOrder = require("./src/_data/snippets.js");
module.exports = function (eleventyConfig) {
eleventyConfig.addPlugin(syntaxHighlight);
eleventyConfig.addWatchTarget("./src/sass/");
eleventyConfig.addPassthroughCopy("./src/img/");
eleventyConfig.addShortcode("year", () => `${new Date().getFullYear()}`);
eleventyConfig.addCollection("orderedSnippets", function (collection) {
const result = [];
let snippetCollection = collection.getFilteredByTag("snippets");
snippetOrder.forEach(function (slug) {
let found = false;
snippetCollection = snippetCollection.filter(function (item) {
if (!found && item.fileSlug == slug) {
result.push(item);
found = true;
return false;
} else return true;
});
});
return result;
});
return {
dir: {
input: "src",
output: "public",
},
};
};