sass-site/eleventy.config.js

76 lines
2.5 KiB
JavaScript
Raw Normal View History

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