2023-07-06 23:24:56 +00:00
|
|
|
const eleventyNavigationPlugin = require("@11ty/eleventy-navigation");
|
2023-07-08 05:16:57 +00:00
|
|
|
const eleventySyntaxHighlight = require("@11ty/eleventy-plugin-syntaxhighlight");
|
2023-07-06 23:24:56 +00:00
|
|
|
const eleventySass = require("eleventy-sass");
|
|
|
|
const mdDefList = require("markdown-it-deflist");
|
2023-07-12 21:46:34 +00:00
|
|
|
const mdToc = require("markdown-it-table-of-contents");
|
|
|
|
const mdAnchor = require("markdown-it-anchor");
|
2023-07-10 21:22:04 +00:00
|
|
|
const eleventyRss = require("@11ty/eleventy-plugin-rss");
|
2023-07-06 23:24:56 +00:00
|
|
|
|
|
|
|
module.exports = function (eleventyConfig) {
|
|
|
|
eleventyConfig.setBrowserSyncConfig({
|
|
|
|
files: "./_site/css/**/*.css",
|
|
|
|
});
|
|
|
|
eleventyConfig.addPassthroughCopy({
|
2023-07-10 04:29:42 +00:00
|
|
|
"node_modules/prism-themes/themes/prism-material-light.min.css":
|
|
|
|
"css/prism-material-light.min.css",
|
|
|
|
"node_modules/prism-themes/themes/prism-material-oceanic.min.css":
|
|
|
|
"css/prism-material-oceanic.min.css",
|
2023-07-08 04:10:03 +00:00
|
|
|
"node_modules/feather-icons/dist/feather-sprite.svg": "images/feather-sprite.svg",
|
2023-07-06 23:24:56 +00:00
|
|
|
"src/js/site.js": "js/site.js"
|
|
|
|
});
|
|
|
|
eleventyConfig.addPlugin(eleventyNavigationPlugin);
|
2023-07-08 05:16:57 +00:00
|
|
|
eleventyConfig.addPlugin(eleventySyntaxHighlight);
|
2023-07-10 21:22:04 +00:00
|
|
|
eleventyConfig.addPlugin(eleventyRss);
|
2023-07-06 23:24:56 +00:00
|
|
|
eleventyConfig.addPlugin(eleventySass, {
|
|
|
|
sass: {
|
|
|
|
loadPaths: ["node_modules"],
|
|
|
|
},
|
|
|
|
});
|
2023-07-12 21:46:34 +00:00
|
|
|
eleventyConfig.amendLibrary("md", mdLib => mdLib
|
|
|
|
.use(mdDefList)
|
|
|
|
.use(mdToc)
|
|
|
|
.use(mdAnchor));
|
2023-07-06 23:24:56 +00:00
|
|
|
|
|
|
|
eleventyConfig.addFilter("IsNotPage", (collection, url) =>
|
|
|
|
collection.filter(item => item.url != url));
|
|
|
|
eleventyConfig.addFilter("IsMainPageSection", (collection) => {
|
|
|
|
return collection.filter(item => !item.url || item.url.startsWith("/_sections"));
|
|
|
|
});
|
|
|
|
eleventyConfig.addFilter("IsNotMainPageSection", (collection) => {
|
2023-07-07 23:42:16 +00:00
|
|
|
return collection.filter(item => {
|
|
|
|
if (item.url == null || item.url == false)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
if (item.data.tags == null)
|
|
|
|
return true;
|
|
|
|
|
|
|
|
if (item.data.tags.includes("MainPage"))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
});
|
2023-07-06 23:24:56 +00:00
|
|
|
});
|
|
|
|
eleventyConfig.addFilter("orderBySectionOrder", (collection) =>
|
|
|
|
collection.sort((a, b) => a.data.sectionOrder - b.data.sectionOrder)
|
|
|
|
);
|
|
|
|
eleventyConfig.addFilter("filterDrafts", collection => {
|
2023-07-10 22:22:32 +00:00
|
|
|
if (process.env.BUILD_DRAFTS == true || process.env.BUILD_DRAFTS == null) {
|
2023-07-06 23:24:56 +00:00
|
|
|
return collection;
|
|
|
|
}
|
|
|
|
|
|
|
|
return collection.filter(item => {
|
|
|
|
if (item.data.draft != null) {
|
|
|
|
return !item.data.draft;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
eleventyConfig.addFilter("log", (value) => console.log(value));
|
|
|
|
|
|
|
|
return {
|
|
|
|
dir: {
|
|
|
|
input: "src",
|
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|