2020-11-26 15:42:01 +00:00
|
|
|
const pluginNavigation = require("@11ty/eleventy-navigation")
|
2021-10-07 16:31:51 +00:00
|
|
|
const htmlmin = require("html-minifier");
|
2021-10-07 20:45:46 +00:00
|
|
|
const markdownIt = require("markdown-it");
|
|
|
|
const markdownItAttrs = require('markdown-it-attrs');
|
|
|
|
const options = {
|
|
|
|
html: true,
|
|
|
|
breaks: true,
|
|
|
|
linkify: true
|
|
|
|
};
|
|
|
|
const markdownLib = markdownIt(options).use(markdownItAttrs);
|
|
|
|
|
2021-05-20 20:02:50 +00:00
|
|
|
module.exports = function (eleventyConfig) {
|
2020-11-19 14:49:52 +00:00
|
|
|
|
2021-10-10 16:29:22 +00:00
|
|
|
eleventyConfig.addGlobalData("username", "Laureηt");
|
2021-05-20 20:02:50 +00:00
|
|
|
eleventyConfig.addPlugin(pluginNavigation);
|
2021-10-07 20:45:46 +00:00
|
|
|
eleventyConfig.setLibrary("md", markdownLib);
|
2021-10-07 16:55:48 +00:00
|
|
|
eleventyConfig.addWatchTarget("./src/scss/");
|
2021-05-20 20:02:50 +00:00
|
|
|
eleventyConfig.addPassthroughCopy({
|
|
|
|
"node_modules/chaffle/docs/chaffle.min.js": "javascript/chaffle.min.js",
|
2021-10-07 16:44:29 +00:00
|
|
|
"assets/": "./",
|
2021-05-20 20:02:50 +00:00
|
|
|
});
|
2020-11-19 15:00:39 +00:00
|
|
|
|
2021-10-07 16:31:51 +00:00
|
|
|
if (process.env.ELEVENTY_ENV == 'prod') {
|
|
|
|
eleventyConfig.addTransform("htmlmin", function (content, outputPath) {
|
|
|
|
// Eleventy 1.0+: use this.inputPath and this.outputPath instead
|
|
|
|
if (outputPath && outputPath.endsWith(".html")) {
|
|
|
|
let minified = htmlmin.minify(content, {
|
|
|
|
useShortDoctype: true,
|
|
|
|
removeComments: true,
|
2021-10-07 16:44:29 +00:00
|
|
|
collapseWhitespace: true,
|
|
|
|
minifyJS: true,
|
|
|
|
minifyCSS: true,
|
2021-10-07 16:31:51 +00:00
|
|
|
});
|
|
|
|
return minified;
|
|
|
|
} else {
|
|
|
|
return content;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2021-05-20 20:02:50 +00:00
|
|
|
eleventyConfig.addShortcode("year", () => {
|
|
|
|
let year = new Date().getFullYear();
|
|
|
|
return year.toString();
|
|
|
|
});
|
|
|
|
|
|
|
|
return {
|
2021-10-07 20:45:46 +00:00
|
|
|
passthroughFileCopy: true,
|
2021-05-20 20:02:50 +00:00
|
|
|
dir: {
|
2021-10-07 20:45:46 +00:00
|
|
|
input: "src",
|
|
|
|
data: "_data",
|
|
|
|
output: "_site",
|
|
|
|
includes: "_includes",
|
2021-05-20 20:02:50 +00:00
|
|
|
},
|
|
|
|
}
|
2020-11-19 15:24:32 +00:00
|
|
|
|
2021-10-07 16:31:51 +00:00
|
|
|
}
|