lucht/.eleventy.js

43 lines
1 KiB
JavaScript
Raw Normal View History

2021-09-05 19:30:48 +00:00
const { DateTime } = require("luxon");
2021-09-03 02:05:52 +00:00
const pluginRss = require("@11ty/eleventy-plugin-rss");
2021-08-31 02:16:17 +00:00
module.exports = function (config) {
2021-09-05 19:30:48 +00:00
// PASSTHROUGHS
2021-09-02 01:20:51 +00:00
2021-09-05 19:30:48 +00:00
// LAYOUTS //
config.addLayoutAlias("base", "layouts/base.njk");
config.addLayoutAlias("post", "layouts/post.njk");
2021-09-03 02:05:52 +00:00
2021-09-05 19:30:48 +00:00
// TRANSFORMS //
2021-09-03 02:05:52 +00:00
// Minify HTML
const htmlMinTransform = require("./src/transforms/html-min.js");
const isProduction = process.env.ELEVENTY_ENV === "production";
// html min only in production
if (isProduction) {
config.addTransform("htmlmin", htmlMinTransform);
}
2021-09-05 19:30:48 +00:00
// PLUG-INS //
2021-09-03 02:05:52 +00:00
config.addPlugin(pluginRss);
2021-09-05 19:30:48 +00:00
// EXTRAS //
// Post List Excerpts
config.setFrontMatterParsingOptions({
excerpt: true,
excerpt_separator: "<!-- excerpt -->",
});
2021-09-03 02:05:52 +00:00
2021-09-05 19:30:48 +00:00
// BASE CONFIGURATION //
2021-08-31 02:16:17 +00:00
return {
dir: {
input: "src",
output: "dist",
includes: "includes",
data: "data",
},
2021-09-03 02:05:52 +00:00
templateFormats: ["html", "njk", "md", "11ty.js"],
2021-08-31 02:16:17 +00:00
htmlTemplateEngine: "njk",
markdownTemplateEngine: "njk",
};
};