generated from 5t3ph/11ty-sass-skeleton
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eleventy.js
117 lines (98 loc) · 3.4 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
const fs = require("fs");
const pluginRss = require("@11ty/eleventy-plugin-rss");
const pluginNavigation = require("@11ty/eleventy-navigation");
const markdownIt = require("markdown-it");
const markdownItAnchor = require("markdown-it-anchor");
const syntaxHighlight = require("@11ty/eleventy-plugin-syntaxhighlight");
const embedCodePen = require("@manustays/eleventy-plugin-codepen-iframe");
// filters
const htmlDateString = require("./src/_11ty/filters/date.js").htmlDateString;
const head = require("./src/_11ty/filters/head.js");
// collections
// const infosDescending = require("./src/_11ty/collections/infosDescending.js");
// const tagList = require("./src/_11ty/collections/tagList.js");
const {
getAllPosts,
getAllNotes
} = require("./src/_11ty/collections/index.js");
const configPath = "./src/_11ty/";
// neu
// const markdownLib = require('./config/plugins/markdown.js');
// const {slugifyString} = require('./config/utils');
module.exports = function (eleventyConfig) {
eleventyConfig.addWatchTarget("./src/assets/scss/");
eleventyConfig.addFilter("htmlDateString", htmlDateString);
eleventyConfig.addFilter("head", head);
// eleventyConfig.addCollection("infosDescending", infosDescending);
// eleventyConfig.addCollection("tagList", tagList);
eleventyConfig.addCollection("getAllPosts", getAllPosts);
eleventyConfig.addCollection("getAllNotes", getAllNotes);
eleventyConfig.addPlugin(pluginNavigation);
eleventyConfig.addPlugin(embedCodePen, {
tabs: "html, css, js,result",
user: "jensgro",
height: 500,
theme: "flocke"
});
// --------------------- layout aliases -----------------------
eleventyConfig.addLayoutAlias('base', 'base.njk');
eleventyConfig.addLayoutAlias('page', 'page.njk');
eleventyConfig.addLayoutAlias('post', 'post.njk');
// eleventyConfig.addLayoutAlias('home', 'home.njk');
// eleventyConfig.addLayoutAlias('blog', 'blog.njk');
// keine Ahnung, was das tut :-)
eleventyConfig.setDataDeepMerge(true);
eleventyConfig.addPassthroughCopy({
"./src/assets/images": "/images",
"./src/assets/fonts": "/fonts",
"./src/static/": "/"
});
eleventyConfig.addPassthroughCopy("css");
eleventyConfig.addPlugin(syntaxHighlight);
/* Markdown Overrides */
let markdownLibrary = markdownIt({
html: true,
breaks: true,
linkify: true
}).use(markdownItAnchor, {
permalink: true,
permalinkClass: "direct-link",
permalinkSymbol: "#"
});
// Watch CSS files for changes
// eleventyConfig.setBrowserSyncConfig({
// files: './_site/css/**/*.css'
// });
eleventyConfig.setServerOptions({
showAllHosts: true,
showVersion: true
});
eleventyConfig.addShortcode("figImg", function (img, figCaption, alt) {
return `<figure class="card">
<img src="../../../images/${img}" class="card-img-top" alt="${alt}">
<figcaption class="card-footer">${figCaption}</figcaption>
</figure>`;
});
eleventyConfig.addShortcode("myImg", function (img, alt) {
return `<img src="../../../images/${img}" class="my-image" alt="${alt}"`;
});
return {
templateFormats: [
"md",
"njk",
"html",
"liquid"
],
markdownTemplateEngine: "njk",
htmlTemplateEngine: "njk",
dataTemplateEngine: "njk",
passthroughFileCopy: true,
dir: {
input: "src",
includes: "_includes",
layouts: "_includes/layouts",
data: "_data",
output: "_site",
},
};
};