-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eleventy.js
39 lines (34 loc) · 1.16 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
const { execSync } = require("child_process");
module.exports = function(eleventyConfig) {
eleventyConfig.setUseGitIgnore(false);
eleventyConfig.addWatchTarget('./src/css/tailwind.css');
eleventyConfig.addPassthroughCopy('./src/img');
eleventyConfig.addPassthroughCopy('./src/admin');
eleventyConfig.on('eleventy.after', async () => {
console.log('Building Tailwind…');
console.log(execSync('npm run build:tailwind').toString());
});
// Enable path prefix for GitHub Pages deployment
if (process.env.PATH_PREFIX){
eleventyConfig.addNunjucksGlobal("PATH_PREFIX", process.env.PATH_PREFIX);
}
eleventyConfig.addCollection('cards', collection => {
return collection
.getFilteredByGlob('./src/cards/*.md')
.sort((a, b) => (Number(a.data.displayOrder) > Number(b.data.displayOrder) ? 1 : -1));
});
eleventyConfig.addCollection('galleries', collection => {
return collection.getFilteredByGlob('./src/galleries/*.md')
})
eleventyConfig.addFilter("debugger", (...args) => {
console.log(...args)
debugger;
})
return {
htmlTemplateEngine: "njk",
dir: {
input: 'src',
output: 'public'
}
}
}