52 lines
1.9 KiB
JavaScript
52 lines
1.9 KiB
JavaScript
const { EleventyHtmlBasePlugin } = require("@11ty/eleventy");
|
|
|
|
module.exports = function (eleventyConfig) {
|
|
// Static passthrough — note src/assets/logos/ (raw design source files) is
|
|
// intentionally excluded; only the cropped, web-sized exports in
|
|
// src/assets/images/ ship to the built site.
|
|
eleventyConfig.addPassthroughCopy({ "src/assets/css": "assets/css" });
|
|
eleventyConfig.addPassthroughCopy({ "src/assets/js": "assets/js" });
|
|
eleventyConfig.addPassthroughCopy({ "src/assets/images": "assets/images" });
|
|
eleventyConfig.addPassthroughCopy({ "src/assets/fonts": "assets/fonts" });
|
|
eleventyConfig.addPassthroughCopy({ "src/robots.txt": "robots.txt" });
|
|
eleventyConfig.addPassthroughCopy({ "src/favicon.ico": "favicon.ico" });
|
|
|
|
eleventyConfig.addPlugin(EleventyHtmlBasePlugin);
|
|
|
|
eleventyConfig.addWatchTarget("src/assets/css/");
|
|
|
|
// Currency formatter — all prices are CAD, whole dollars.
|
|
eleventyConfig.addFilter("cad", (value) => {
|
|
if (value === null || value === undefined || value === "") return "";
|
|
return new Intl.NumberFormat("en-CA", {
|
|
style: "currency",
|
|
currency: "CAD",
|
|
maximumFractionDigits: 0,
|
|
}).format(value);
|
|
});
|
|
|
|
// Prepay pricing: 3yr = 2.5x annual, 5yr = 4x annual (applied to "every year after" fees).
|
|
eleventyConfig.addFilter("prepay", (annual, years) => {
|
|
const multiplier = years === 5 ? 4 : years === 3 ? 2.5 : 1;
|
|
return Math.round(annual * multiplier);
|
|
});
|
|
|
|
eleventyConfig.addFilter("sum", (values) => values.reduce((a, b) => a + b, 0));
|
|
|
|
eleventyConfig.addFilter("findByKey", (arr, value) => (arr || []).find((item) => item.key === value));
|
|
|
|
eleventyConfig.addShortcode("year", () => `${new Date().getFullYear()}`);
|
|
|
|
return {
|
|
dir: {
|
|
input: "src",
|
|
output: "_site",
|
|
includes: "_includes",
|
|
data: "_data",
|
|
},
|
|
templateFormats: ["njk", "md", "11ty.js"],
|
|
htmlTemplateEngine: "njk",
|
|
markdownTemplateEngine: "njk",
|
|
};
|
|
};
|