48 lines
1.2 KiB
JavaScript
Executable file
48 lines
1.2 KiB
JavaScript
Executable file
const pluginNavigation = require("@11ty/eleventy-navigation")
|
|
const htmlmin = require("html-minifier");
|
|
|
|
module.exports = function (eleventyConfig) {
|
|
|
|
eleventyConfig.addPlugin(pluginNavigation);
|
|
|
|
eleventyConfig.addWatchTarget("./src/scss/");
|
|
|
|
eleventyConfig.addPassthroughCopy({
|
|
"node_modules/chaffle/docs/chaffle.min.js": "javascript/chaffle.min.js",
|
|
"assets/": "./",
|
|
});
|
|
|
|
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,
|
|
collapseWhitespace: true,
|
|
minifyJS: true,
|
|
minifyCSS: true,
|
|
});
|
|
return minified;
|
|
} else {
|
|
return content;
|
|
}
|
|
});
|
|
}
|
|
|
|
eleventyConfig.addShortcode("year", () => {
|
|
let year = new Date().getFullYear();
|
|
return year.toString();
|
|
});
|
|
|
|
return {
|
|
dir: {
|
|
input: "src"
|
|
},
|
|
dataTemplateEngine: 'njk',
|
|
htmlTemplateEngine: 'njk',
|
|
markdownTemplateEngine: 'njk',
|
|
}
|
|
|
|
}
|