-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eleventy.js
53 lines (43 loc) · 1.24 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
53
const markdownIt = require("markdown-it");
const sass = require("sass");
module.exports = function (eleventyConfig) {
// Add static files
eleventyConfig.addPassthroughCopy("src/static/");
// Add ignored files
eleventyConfig.setUseGitIgnore(false);
eleventyConfig.ignores.add("README.md");
eleventyConfig.ignores.add("node_modules/**");
eleventyConfig.ignores.add("build/**");
// Liquid
eleventyConfig.setLiquidOptions({
jsTruthy: true,
});
// Add sass
eleventyConfig.addTemplateFormats("scss");
// Creates the extension for use
eleventyConfig.addExtension("scss", {
outputFileExtension: "css", // optional, default: "html"
// `compile` is called once per .scss file in the input directory
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;
};
},
});
// Add a new filter called "markdown" that converts the contents from md -> html
const md = new markdownIt({
html: true,
});
eleventyConfig.addPairedShortcode("markdown", content => {
return md.render(content);
});
return {
dir: {
input: "src",
output: "build",
},
markdownTemplateEngine: "liquid",
};
};