-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eleventy.js
56 lines (47 loc) · 1.6 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
const eleventyNavigationPlugin = require('@11ty/eleventy-navigation');
const jsonFilters = require('./src/filters/json');
const ordinalFilter = require('./src/filters/ordinal');
const htmlMinify = require('./src/transforms/html-minify');
const markdownIt = require("markdown-it");
const dotenv = require('dotenv');
dotenv.config();
module.exports = function(eleventyConfig) {
// Environment
eleventyConfig.addGlobalData('env', process.env);
// Production
if (process.env.NODE_ENV === 'production') {
eleventyConfig.addTransform("htmlmin", htmlMinify);
}
// Collections
eleventyConfig.addCollection("betaCourses", function(collectionApi) {
return collectionApi.getFilteredByTags("courses", "beta")
});
eleventyConfig.addCollection("releaseCourses", function(collectionApi) {
return collectionApi.getFilteredByTags("courses", "release")
});
// Plugins
eleventyConfig.addPlugin(eleventyNavigationPlugin);
// Passthroughs
eleventyConfig.addPassthroughCopy("content/**/*.css");
eleventyConfig.addPassthroughCopy("content/CNAME");
eleventyConfig.addPassthroughCopy("**/*.(jpg|png|gif)");
// Filters
eleventyConfig.addFilter("toJson", jsonFilters.toJson);
eleventyConfig.addFilter("fromJson", jsonFilters.fromJson);
eleventyConfig.addFilter("ordinal", ordinalFilter);
const md = new markdownIt({
html: true
});
eleventyConfig.addPairedShortcode("markdown", (content) => {
return md.render(content);
});
return {
passthroughFileCopy: true,
dir: {
input: "content",
includes: "_includes",
data: "_data",
output: "_site"
}
};
};