forked from ct-js/ct-js-site
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eleventy.js
50 lines (45 loc) · 1.85 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
const markdownIt = require('markdown-it');
const emoji = require('markdown-it-emoji').full;
const mdReplacePlugin = require('@deco313/markdown-it-replace').default();
const md = new markdownIt({
html: true,
linkify: true,
typographer: true
})
.use(emoji)
.use(
mdReplacePlugin
.addRule(/[\s(](@\w+)/, nickname => `<a href="https://github.com/${nickname.slice(1)}" target="_blank">${nickname}</a>`)
.addRule(/[\s(](#\d+)/, id => `<a href="https://github.com/ct-js/ct-js/issues/${id.slice(1)}" target="_blank">${id}</a>`)
);
module.exports = function(eleventyConfig) {
eleventyConfig.addPassthroughCopy('src/img');
eleventyConfig.addPassthroughCopy('src/fonts');
eleventyConfig.addPassthroughCopy('src/ctjsWebInstaller.exe');
eleventyConfig.addPassthroughCopy('src/browserconfig.xml');
eleventyConfig.addPassthroughCopy('src/manifest.json');
eleventyConfig.addPassthroughCopy('src/favicon.ico');
eleventyConfig.addPassthroughCopy('src/admin/config.yml');
eleventyConfig.addPassthroughCopy('src/staticApis/*.json');
eleventyConfig.addPassthroughCopy('src/releaseHelper/*.meat');
eleventyConfig.addPassthroughCopy('src/releaseHelper/boneyard.browser.min.js');
// Expose data managed by Decap CMS to Eleventy templates
eleventyConfig.addGlobalData('home', require('./src/staticApis/ctHome.json'));
eleventyConfig.addFilter("markdown", (content) => {
return md.render(content);
});
// Expose eleventy filters to Pug
// @see my https://github.com/11ty/eleventy/issues/1523#issuecomment-733412641
global.filters = eleventyConfig.javascriptFunctions;
eleventyConfig.setPugOptions({
globals: ['filters']
});
return {
dir: {
input: 'src',
output: 'dist',
includes: '_includes'
},
passthroughFileCopy: true
};
};