import { createRequire } from "module"; import "dotenv/config"; import filters from "./config/filters/index.js"; import tablerIcons from "@cdransf/eleventy-plugin-tabler-icons"; import { minifyJsComponents } from "./config/events/minify-js.js"; import { albumReleasesCalendar } from "./config/collections/index.js"; import plugins from "./config/plugins/index.js"; const require = createRequire(import.meta.url); const appVersion = require("./package.json").version; export default async function (eleventyConfig) { eleventyConfig.addPlugin(tablerIcons); eleventyConfig.addPlugin(plugins.cssConfig); eleventyConfig.setQuietMode(true); eleventyConfig.configureErrorReporting({ allowMissingExtensions: true }); eleventyConfig.setLiquidOptions({ jsTruthy: true }); eleventyConfig.watchIgnores.add("queries/**"); eleventyConfig.addPassthroughCopy("src/assets"); eleventyConfig.addPassthroughCopy("api"); eleventyConfig.addPassthroughCopy("vendor"); eleventyConfig.addPassthroughCopy("server"); eleventyConfig.addPassthroughCopy({ "node_modules/minisearch/dist/umd/index.js": "assets/scripts/components/minisearch.js", "node_modules/youtube-video-element/dist/youtube-video-element.js": "assets/scripts/components/youtube-video-element.js", }); eleventyConfig.addCollection("albumReleasesCalendar", albumReleasesCalendar); eleventyConfig.setLibrary("md", plugins.markdownLib); eleventyConfig.addLiquidFilter("markdown", (content) => { if (!content) return; return plugins.markdownLib.render(content); }); Object.keys(filters).forEach((filterName) => { eleventyConfig.addLiquidFilter(filterName, filters[filterName]); }); eleventyConfig.addShortcode("appVersion", () => appVersion); eleventyConfig.on("afterBuild", minifyJsComponents); return { dir: { input: "src", includes: "includes", layouts: "layouts", data: "data", output: "dist", } }; }