site/.eleventy.js

40 lines
1 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");
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,
};
const md = new markdownIt(MARKDOWN_OPTIONS);
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
eleventyConfig.addFilter("formatDate", (dateObj) => {
2024-07-07 16:29:27 -04:00
return DateTime.fromJSDate(dateObj).toFormat("y'-'LL'-'dd' 'HH':'mm");
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
},
};
};