site/.eleventy.js

44 lines
1.2 KiB
JavaScript
Raw Normal View History

2023-10-19 22:31:19 -04:00
const eleventyNavigationPlugin = require("@11ty/eleventy-navigation");
2024-07-07 16:29:27 -04:00
const markdownIt = require("markdown-it");
2024-07-08 01:17:58 -04:00
const markdownItFootnote = require("markdown-it-footnote");
const markdownItAnchor = require("markdown-it-anchor");
2023-10-19 01:33:51 -04:00
const { DateTime } = require("luxon");
2024-07-07 16:29:27 -04:00
const MARKDOWN_OPTIONS = {
html: true,
breaks: true,
linkify: true,
typographer: true,
};
2024-07-08 01:17:58 -04:00
const md = new markdownIt(MARKDOWN_OPTIONS)
.use(markdownItFootnote)
.use(markdownItAnchor);
2024-07-07 16:29:27 -04:00
2023-10-18 13:32:43 -04:00
module.exports = function (eleventyConfig) {
2024-07-07 16:29:27 -04:00
// Libraries
eleventyConfig.setLibrary("md", md);
// Plugins
2023-10-19 22:31:19 -04:00
eleventyConfig.addPlugin(eleventyNavigationPlugin);
2024-07-07 16:29:27 -04:00
// Filters
2024-07-08 01:17:58 -04:00
eleventyConfig.addFilter("formatDate", (dateObj, format) => {
return DateTime.fromJSDate(dateObj).toFormat(format);
2023-10-19 01:33:51 -04:00
});
2024-07-07 16:29:27 -04:00
// Passthrough copies
eleventyConfig.addPassthroughCopy({ "./src/res/css/**/*.css": "css" });
eleventyConfig.addPassthroughCopy({ "./src/res/font": "font" });
eleventyConfig.addPassthroughCopy({ "./src/res/img": "img" });
2024-07-07 16:29:27 -04:00
eleventyConfig.addPassthroughCopy({ "./src/res/*.txt": "." });
eleventyConfig.addWatchTarget("./src/res/css"); // Watch stylesheets
2023-10-18 13:32:43 -04:00
return {
dir: {
input: "src",
output: "_site",
2023-10-18 13:32:43 -04:00
},
};
};