2023-01-09 20:10:02 +01:00
|
|
|
'use strict';
|
2023-01-06 23:37:45 +01:00
|
|
|
|
2023-02-02 21:52:26 +01:00
|
|
|
const { EleventyRenderPlugin } = require('@11ty/eleventy');
|
2023-04-04 20:22:44 +02:00
|
|
|
const {
|
|
|
|
absoluteUrl,
|
|
|
|
convertHtmlToAbsoluteUrls,
|
|
|
|
dateToRfc3339,
|
|
|
|
getNewestCollectionItemDate,
|
|
|
|
} = require('@11ty/eleventy-plugin-rss');
|
2023-01-31 20:18:33 +01:00
|
|
|
const syntaxHighlight = require('@11ty/eleventy-plugin-syntaxhighlight');
|
2023-01-24 23:51:07 +01:00
|
|
|
const yaml = require('js-yaml');
|
2023-03-07 21:45:47 +01:00
|
|
|
|
2023-03-09 23:32:49 +01:00
|
|
|
const componentsPlugin =
|
|
|
|
require('./source/helpers/components/index.ts').default;
|
|
|
|
const datesPlugin = require('./source/helpers/dates.ts').default;
|
2023-03-08 21:59:19 +01:00
|
|
|
const { liquidEngine, markdownEngine } = require('./source/helpers/engines.ts');
|
2023-03-09 23:32:49 +01:00
|
|
|
const pagesPlugin = require('./source/helpers/pages.ts').default;
|
|
|
|
const typePlugin = require('./source/helpers/type.ts').default;
|
2023-05-27 01:11:28 +02:00
|
|
|
const functionPlugin = require('./source/helpers/function.ts').default;
|
2023-01-24 23:51:07 +01:00
|
|
|
|
2023-01-06 22:40:29 +01:00
|
|
|
/** @param {import('@11ty/eleventy').UserConfig} eleventyConfig */
|
2023-01-06 23:37:45 +01:00
|
|
|
module.exports = (eleventyConfig) => {
|
2023-01-09 20:10:02 +01:00
|
|
|
eleventyConfig.addPassthroughCopy('source/assets/dist');
|
|
|
|
eleventyConfig.addPassthroughCopy('source/assets/img');
|
|
|
|
eleventyConfig.addPassthroughCopy('source/favicon.ico');
|
2023-04-11 22:50:11 +02:00
|
|
|
eleventyConfig.addPassthroughCopy('source/icon.png');
|
2023-04-05 23:49:42 +02:00
|
|
|
eleventyConfig.addPassthroughCopy('source/browserconfig.xml');
|
|
|
|
eleventyConfig.addPassthroughCopy('source/tile.png');
|
|
|
|
eleventyConfig.addPassthroughCopy('source/tile-wide.png');
|
|
|
|
eleventyConfig.addPassthroughCopy('source/robots.txt');
|
2023-01-06 22:40:29 +01:00
|
|
|
|
2023-01-11 18:30:24 +01:00
|
|
|
eleventyConfig.setUseGitIgnore(false);
|
2023-02-02 22:14:26 +01:00
|
|
|
eleventyConfig.watchIgnores.add('source/_data/versionCache.json');
|
2023-01-10 23:05:39 +01:00
|
|
|
|
2023-03-08 21:59:19 +01:00
|
|
|
eleventyConfig.setLibrary('liquid', liquidEngine);
|
|
|
|
eleventyConfig.setLibrary('md', markdownEngine);
|
2023-02-01 23:35:15 +01:00
|
|
|
eleventyConfig.addDataExtension('yml, yaml', (contents) =>
|
|
|
|
yaml.load(contents),
|
|
|
|
);
|
2023-06-16 19:45:29 +02:00
|
|
|
eleventyConfig.addDataExtension('ts', (_, filepath) => require(filepath));
|
2023-01-24 23:51:07 +01:00
|
|
|
|
2023-03-09 23:32:49 +01:00
|
|
|
// register filters and shortcodes
|
|
|
|
eleventyConfig.addPlugin(componentsPlugin);
|
|
|
|
eleventyConfig.addPlugin(datesPlugin);
|
|
|
|
eleventyConfig.addPlugin(pagesPlugin);
|
|
|
|
eleventyConfig.addPlugin(typePlugin);
|
2023-05-27 01:11:28 +02:00
|
|
|
eleventyConfig.addPlugin(functionPlugin);
|
2023-02-25 13:44:14 +01:00
|
|
|
|
2023-04-04 20:22:44 +02:00
|
|
|
// rss plugin
|
|
|
|
eleventyConfig.addLiquidFilter('absoluteUrl', absoluteUrl);
|
|
|
|
eleventyConfig.addLiquidFilter(
|
|
|
|
'getNewestCollectionItemDate',
|
|
|
|
getNewestCollectionItemDate,
|
|
|
|
);
|
|
|
|
eleventyConfig.addLiquidFilter('dateToRfc3339', dateToRfc3339);
|
|
|
|
eleventyConfig.addLiquidFilter(
|
|
|
|
'htmlToAbsoluteUrls',
|
|
|
|
convertHtmlToAbsoluteUrls,
|
|
|
|
);
|
|
|
|
|
2023-03-09 23:32:49 +01:00
|
|
|
// other plugins
|
2023-01-29 21:04:56 +01:00
|
|
|
eleventyConfig.addPlugin(EleventyRenderPlugin);
|
2023-04-17 17:21:52 +02:00
|
|
|
eleventyConfig.addPlugin(syntaxHighlight, {
|
|
|
|
errorOnInvalidLanguage: true,
|
|
|
|
});
|
2023-01-29 21:04:56 +01:00
|
|
|
|
2023-03-10 22:44:54 +01:00
|
|
|
eleventyConfig.setQuietMode(true);
|
|
|
|
|
2023-01-06 23:37:45 +01:00
|
|
|
// settings
|
|
|
|
return {
|
|
|
|
dir: {
|
2023-01-09 20:10:02 +01:00
|
|
|
input: 'source',
|
|
|
|
includes: '_includes',
|
|
|
|
layouts: '_layouts',
|
2023-01-06 23:37:45 +01:00
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|