eleventy-mainroad/eleventy.config.js

52 lines
1.7 KiB
JavaScript

const pluginWebc = require("@11ty/eleventy-plugin-webc");
const htmlmin = require("html-minifier");
module.exports = function (ec) {
// Plugins
// add webc files by default
ec.addPlugin(pluginWebc, { components: "_includes/components/**/*.webc" });
ec.addTransform("htmlmin", function (content) {
// Prior to Eleventy 2.0: use this.outputPath instead
if (this.page.outputPath && this.page.outputPath.endsWith(".html")) {
let minified = htmlmin.minify(content, {
useShortDoctype: true,
collapseWhitespace: true,
});
return minified;
}
return content;
});
return {
// Control which files Eleventy will process
// e.g.: *.md, *.njk, *.html, *.liquid
templateFormats: ["md", "njk", "html", "liquid"],
// Pre-process *.md files with: (default: `liquid`)
markdownTemplateEngine: "njk",
// Pre-process *.html files with: (default: `liquid`)
htmlTemplateEngine: "njk",
// These are all optional:
dir: {
input: "content", // default: "."
includes: "../_includes", // default: "_includes"
data: "../_data", // default: "_data"
output: "_site",
},
// -----------------------------------------------------------------
// Optional items:
// -----------------------------------------------------------------
// If your site deploys to a subdirectory, change `pathPrefix`.
// Read more: https://www.11ty.dev/docs/config/#deploy-to-a-subdirectory-with-a-path-prefix
// When paired with the HTML <base> plugin https://www.11ty.dev/docs/plugins/html-base/
// it will transform any absolute URLs in your HTML to include this
// folder name and does **not** affect where things go in the output folder.
pathPrefix: "/",
};
};