This repository has been archived by the owner on Jun 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eleventy.js
104 lines (86 loc) · 2.9 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
const pluginRss = require('@11ty/eleventy-plugin-rss')
const pluginNavigation = require('@11ty/eleventy-navigation')
const syntaxHighlight = require('@11ty/eleventy-plugin-syntaxhighlight')
const filters = require('./utils/filters.js')
const shortcodes = require('./utils/shortcodes.js')
const pairedshortcodes = require('./utils/paired-shortcodes.js')
module.exports = function (eleventyConfig) {
/**
* Plugins
* @link https://www.11ty.dev/docs/plugins/
*/
eleventyConfig.addPlugin(pluginRss)
eleventyConfig.addPlugin(pluginNavigation)
eleventyConfig.addPlugin(syntaxHighlight)
/**
* Filters
* @link https://www.11ty.io/docs/filters/
*/
Object.keys(filters).forEach((filterName) => {
eleventyConfig.addFilter(filterName, filters[filterName])
})
/**
* Shortcodes
* @link https://www.11ty.io/docs/shortcodes/
*/
Object.keys(shortcodes).forEach((shortcodeName) => {
eleventyConfig.addShortcode(shortcodeName, shortcodes[shortcodeName])
})
/**
* Paired Shortcodes
* @link https://www.11ty.dev/docs/languages/nunjucks/#paired-shortcode
*/
Object.keys(pairedshortcodes).forEach((shortcodeName) => {
eleventyConfig.addPairedShortcode(
shortcodeName,
pairedshortcodes[shortcodeName]
)
})
/**
* Collections
* ============================
*
* POST Collection set so we can check status of "draft:" frontmatter.
* If set "true" then post will NOT be processed in PRODUCTION env.
* If "false" or NULL it will be published in PRODUCTION.
* Every Post will ALWAYS be published in DEVELOPMENT so you can preview locally.
*/
eleventyConfig.addCollection('post', (collection) => {
if (process.env.ELEVENTY_ENV !== 'production')
return [...collection.getFilteredByGlob('./src/posts/*.md')]
else
return [...collection.getFilteredByGlob('./src/posts/*.md')].filter((post) => !post.data.draft)
})
/**
* Custom Watch Targets
* for when the Tailwind config or .css files change...
* by default not watched by 11ty
* @link https://www.11ty.dev/docs/config/#add-your-own-watch-targets
*/
eleventyConfig.addWatchTarget('./src/assets/css')
// eleventyConfig.addWatchTarget('./utils/*.js')
eleventyConfig.addWatchTarget('./tailwind.config.js')
/**
* Passthrough File Copy
* @link https://www.11ty.dev/docs/copy/
*/
eleventyConfig.addPassthroughCopy('src/*.png')
eleventyConfig.addPassthroughCopy('src/*.jpg')
eleventyConfig.addPassthroughCopy('src/*.ico')
eleventyConfig.addPassthroughCopy('src/robots.txt')
eleventyConfig.addPassthroughCopy('src/assets/images/')
eleventyConfig.addPassthroughCopy('src/assets/svg/')
eleventyConfig.addPassthroughCopy('src/assets/css/prism*.css')
return {
dir: {
input: 'src',
output: 'dist',
includes: '_includes',
data: '_data',
},
passthroughFileCopy: true,
templateFormats: ['html', 'njk', 'md'],
htmlTemplateEngine: 'njk',
markdownTemplateEngine: 'njk',
}
};