Files
diana/.eleventy.js

34 lines
989 B
JavaScript

module.exports = function (eleventyConfig) {
// Pass static assets through to _site/
eleventyConfig.addPassthroughCopy("src/css");
eleventyConfig.addPassthroughCopy("src/js");
eleventyConfig.addPassthroughCopy({ "assets": "assets" });
// Format phone number as a tel: href (strips everything but digits and +)
eleventyConfig.addFilter("telHref", (phone) =>
"tel:" + phone.replace(/[^0-9+]/g, "")
);
// Current year for footer copyright
eleventyConfig.addFilter("currentYear", () =>
new Date().getFullYear()
);
// Wrap & with a Georgia-italic span so headings use an elegant ampersand
eleventyConfig.addFilter("styleAmp", (str) =>
String(str).replace(/&amp;|&/g, '<span class="amp">&amp;</span>')
);
return {
templateFormats: ["njk", "html", "xml", "txt"],
htmlTemplateEngine: "njk",
markdownTemplateEngine: "njk",
dir: {
input: "src",
output: "_site",
includes: "_includes",
data: "_data",
},
};
};