-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eleventy.js
52 lines (41 loc) · 1.26 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
49
50
51
52
const sass = require("sass");
const MarkdownIt = require("markdown-it");
// https://www.npmjs.com/package/markdown-it
const md = new MarkdownIt({
html: true,
linkify: true,
});
module.exports = function (eleventyConfig) {
eleventyConfig.addTemplateFormats("scss");
// Creates the extension for use
eleventyConfig.addExtension("scss", {
outputFileExtension: "css",
compile: async function (inputContent) {
let result = sass.compileString(inputContent);
// This is the render function, `data` is the full data cascade
return async (data) => {
return result.css;
};
},
});
eleventyConfig.addShortcode("year", function () {
const d = new Date();
return d.getFullYear();
});
eleventyConfig.addFilter("filterMenu", (blocks) => {
return blocks.filter((b) => !!b.menuTitle);
});
eleventyConfig.addFilter("defaultStr", function (str) {
return str || "";
});
eleventyConfig.addShortcode("markdown", (str) => {
return md.render(str);
});
eleventyConfig.addPassthroughCopy("src/css");
eleventyConfig.addPassthroughCopy("src/font");
eleventyConfig.addPassthroughCopy("src/images");
eleventyConfig.addPassthroughCopy("src/js");
return {
dir: { input: "src", output: "_site" },
};
};