generated from inherentlee/11ty
69 lines
1.5 KiB
JavaScript
69 lines
1.5 KiB
JavaScript
import { attrs } from "@mdit/plugin-attrs";
|
|
import { eleventyImageTransformPlugin } from "@11ty/eleventy-img";
|
|
|
|
import pluginFilters from "./_config/filters.js";
|
|
|
|
export default async function (eleventyConfig) {
|
|
/* Markdown HTML attribute parsing */
|
|
eleventyConfig.amendLibrary("md", (mdLib) => mdLib.use(attrs));
|
|
|
|
/* Bundles */
|
|
/* CSS */
|
|
eleventyConfig.addBundle("css", {
|
|
toFileDirectory: "dist",
|
|
bundleHtmlContentFromSelector: "style",
|
|
});
|
|
|
|
/* Javascript */
|
|
eleventyConfig.addBundle("js", {
|
|
toFileDirectory: "dist",
|
|
bundleHtmlContentFromSelector: "script",
|
|
});
|
|
|
|
/* Passthroughs */
|
|
eleventyConfig.addPassthroughCopy("./favicon.ico");
|
|
|
|
/* Images */
|
|
eleventyConfig.addPlugin(eleventyImageTransformPlugin, {
|
|
// output image formats
|
|
formats: ["auto"],
|
|
|
|
// output image widths
|
|
widths: ["auto"],
|
|
|
|
// fail on error
|
|
failOnError: true,
|
|
|
|
// optional, attributes assigned on <img> nodes override these values
|
|
htmlOptions: {
|
|
imgAttributes: {
|
|
loading: "lazy",
|
|
decoding: "async",
|
|
},
|
|
},
|
|
});
|
|
|
|
/* All filters from _config/filters.js */
|
|
eleventyConfig.addPlugin(pluginFilters);
|
|
|
|
/* Shortcodes */
|
|
eleventyConfig.addShortcode("currentBuildDate", () => {
|
|
return new Date().toISOString();
|
|
});
|
|
|
|
/* Watch when serving */
|
|
eleventyConfig.addWatchTarget("css");
|
|
}
|
|
|
|
export const config = {
|
|
dir: {
|
|
input: "src",
|
|
includes: "../_includes",
|
|
layouts: "../_includes/layouts",
|
|
data: "../_data",
|
|
},
|
|
markdownTemplateEngine: "njk",
|
|
htmlTemplateEngine: "njk",
|
|
templateFormats: ["html", "md", "njk"],
|
|
};
|