-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.eleventy.js
61 lines (52 loc) · 1.69 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
const {EleventyRenderPlugin} = require('@11ty/eleventy');
const pluginWebc = require('@11ty/eleventy-plugin-webc');
const prettify = require('html-prettify');
const syntaxHighlight = require('@11ty/eleventy-plugin-syntaxhighlight');
module.exports = (config) => {
// Tell 11ty to use the .eleventyignore and ignore our .gitignore file
config.setUseGitIgnore(false);
/* Plugins */
config.addPlugin(EleventyRenderPlugin);
config.addPlugin(pluginWebc, {
components: 'src/_includes/components/**/*.webc'
});
config.addPlugin(syntaxHighlight);
/* Pass Through File Copy */
config.addPassthroughCopy('./src/assets/fonts');
config.addPassthroughCopy('./src/assets/images');
config.addPassthroughCopy('./src/assets/js/vendor');
/* Shortcodes */
config.addPairedShortcode('brace', function (content, type = 'curly') {
const [opening, closing] = {
curly: ['{{', '}}'],
silent: ['{%-', '-%}']
}[type];
return `${opening}${content}${closing}`;
});
config.addPairedShortcode('prettify', (content) => {
return prettify(content);
});
/* Filters */
config.addFilter('console', function (value) {
return JSON.stringify(value, null, 2);
});
/* Custom Collections */
// Filter source file names using a glob
config.addCollection('dsAtoms', function (collectionApi) {
return collectionApi.getFilteredByGlob('**/design-system/Atoms/**/*');
});
let pathPrefix = '/';
if (process.env.NODE_ENV == 'production') {
pathPrefix = '/11ty-design-system/';
}
return {
markdownTemplateEngine: 'njk',
dataTemplateEngine: 'njk',
htmlTemplateEngine: 'njk',
pathPrefix: pathPrefix,
dir: {
input: 'src',
output: 'dist'
}
};
};