const eleventySass = require("eleventy-sass");
const toml = require("@iarna/toml");
const {EleventyI18nPlugin} = require('@11ty/eleventy');

module.exports = function(eleventyConfig) {
    eleventyConfig.setLayoutsDirectory("_layouts");
    
    eleventyConfig.addPassthroughCopy("img");
    eleventyConfig.addPassthroughCopy("css/fonts");
    eleventyConfig.addPassthroughCopy("js");
    eleventyConfig.addPassthroughCopy("LICENSE.txt");

    eleventyConfig.addNunjucksFilter("values", obj => Object.values(obj));

    eleventyConfig.addPlugin(EleventyI18nPlugin, {
        defaultLanguage: "en"
    });
    eleventyConfig.addPlugin(eleventySass);
    eleventyConfig.addDataExtension("toml", (contents) => toml.parse(contents));

    return {
        markdownTemplateEngine: "njk",
        htmlTemplateEngine: "njk"
    }
};