/** @param {import("@11ty/eleventy").UserConfig} eleventyConfig */
export default async function(eleventyConfig) {
eleventyConfig.addPassthroughCopy(
{'./public/': '/'}
);
eleventyConfig.addShortcode("triangleSvg", function(strokeWidth = 10) {
const w = parseFloat(strokeWidth);
if (isNaN(w) || w <= 0) {
throw new Error("strokeWidth must be a positive number");
}
// Scale offsets based on strokeWidth
const topInset = +(w * 1.05).toFixed(2);
const bottomInset = +(w * 0.5).toFixed(2);
const sideInset = +(w * 0.8).toFixed(2);
const topPoint = `50,${topInset}`;
const leftPoint = `${sideInset},${100 - bottomInset}`;
const rightPoint = `${100 - sideInset},${100 - bottomInset}`;
const points = `${topPoint} ${leftPoint} ${rightPoint}`;
return `
`;
});
eleventyConfig.addShortcode("squareSvg", function(strokeWidth = 10, className = "square") {
const w = parseFloat(strokeWidth);
if (isNaN(w) || w <= 0) {
throw new Error("strokeWidth must be a positive number");
}
const inset = +(w / 2).toFixed(2);
const x1 = inset;
const y1 = inset;
const x2 = 100 - inset;
const y2 = 100 - inset;
return `
`;
});
}