-
Notifications
You must be signed in to change notification settings - Fork 2
/
.eleventy.js
79 lines (67 loc) · 2.03 KB
/
.eleventy.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
require('module-alias/register');
const yaml = require('js-yaml');
const pluginNavigation = require('@11ty/eleventy-navigation');
const pluginVue = require('@11ty/eleventy-plugin-vue');
const pluginVite = require('@11ty/eleventy-plugin-vite');
const config = require('./.config.js');
const filters = require('./utils/filters');
module.exports = function (eleventyConfig) {
/**
* Add plugins
*
* @link https://www.11ty.dev/docs/plugins/
*/
eleventyConfig.addPlugin(pluginNavigation);
eleventyConfig.addPlugin(pluginVue, {
rollupPluginVueOptions: {
style: {
postcssPlugins: [
//require('autoprefixer')
],
},
},
});
eleventyConfig.addPlugin(pluginVite, {
tempFolderName: config.viteTemp, // Default name of the temp folder
});
/**
* Add filters
*
* @link https://www.11ty.io/docs/filters/
*/
Object.keys(filters).forEach(filterName => {
eleventyConfig.addFilter(filterName, filters[filterName]);
});
/**
* Passthrough file copy
*
* @link https://www.11ty.io/docs/copy/
*/
eleventyConfig.addPassthroughCopy('src');
/**
* Add layout aliases
*
* @link https://www.11ty.dev/docs/layouts/#layout-aliasing
*/
eleventyConfig.addLayoutAlias('base', 'base.njk');
eleventyConfig.addLayoutAlias('page', 'page.njk');
/**
* Opts in to a full deep merge when combining the Data Cascade.
*
* @link https://www.11ty.dev/docs/data-deep-merge/#data-deep-merge
*/
eleventyConfig.setDataDeepMerge(true);
eleventyConfig.addDataExtension('yaml', contents => yaml.safeLoad(contents));
eleventyConfig.addDataExtension('yml', contents => yaml.safeLoad(contents));
eleventyConfig.setServerPassthroughCopyBehavior('copy');
eleventyConfig.addFilter('removeSelfByUrl', function (collection, url) {
return collection.filter(item => item.url !== url);
});
return {
dir: config.dir,
passthroughFileCopy: true,
templateFormats: ['njk', 'md', '11ty.js'],
htmlTemplateEngine: 'njk',
markdownTemplateEngine: 'njk',
};
};