const htmlmin = require("html-minifier"); const rimraf = require("rimraf"); const cleancss = require("clean-css"); module.exports = function (eleventyConfig) { // delete contents of public to ensure removed files are removed from the final build rimraf.windows.sync("public/") eleventyConfig.addPassthroughCopy("./src/_assets/css"); eleventyConfig.addPassthroughCopy("./src/_assets/img"); eleventyConfig.addPassthroughCopy("./src/_assets/fonts"); eleventyConfig.addPassthroughCopy("./src/_assets/js"); eleventyConfig.addShortcode("albumtile", function (title, embedLink, coverImage) { // hugely overcomplicated universal slug method var slug = title .toLowerCase() .trim() // remove accents .normalize('NFD') .replace(/[\u0300-\u036f]/g, '') // replace invalid characters with spaces .replace(/[^a-z0-9\s-]/g, ' ') .trim() // replace multiple spaces or hyphens with a hyphen .replace(/[\s-]+/g, '-'); return `
` }); eleventyConfig.addShortcode("infinitenightmare", function (title, link, image, video, description) { if (!title || title == "") { return ''; }; var slug = title .toLowerCase() .trim() // remove accents .normalize('NFD') .replace(/[\u0300-\u036f]/g, '') // replace invalid characters with spaces .replace(/[^a-z0-9\s-]/g, ' ') .trim() // replace multiple spaces or hyphens with a hyphen .replace(/[\s-]+/g, '-'); return `
${title}
${
// evil nested tertiary this is the worlds least oneline oneliner
!link || link == "" ?
"" :
Array.isArray(link) ?
(typeof link[0] === 'string' ?
link.map((l) => `link
`).join(" // ") + '
' :
link.map((l) => `${l.title}`).join(" // ") + '
') :
`link
`
}${!image || image == "" ?
"" :
Array.isArray(image) ?
image.map((i, index) => `
`).join(" ") :
`
`
}${!video || video == "" ?
"" :
`
`
}${description}