-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eleventy.js
38 lines (31 loc) · 1005 Bytes
/
.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
const syntaxHighlight = require("@11ty/eleventy-plugin-syntaxhighlight");
const pluginRss = require("@11ty/eleventy-plugin-rss");
const CleanCSS = require("clean-css");
module.exports = function (cfg) {
cfg.addPassthroughCopy("src/{css,images,js}/*.*");
cfg.addPassthroughCopy("src/**/*.{htaccess,gif,ico,jpg,png,pdf,txt,webp}");
cfg.addPassthroughCopy("src/_redirects");
cfg.addFilter("filterTagList", (tags) => {
return (tags || []).filter(
(tag) => ["all", "articles"].indexOf(tag) === -1
);
});
cfg.addFilter("postDate", (dateObj) => {
var isoDate = dateObj.toISOString();
return isoDate.substring(0, 10);
});
cfg.addNunjucksFilter("limit", (arr, limit, offset) => {
return arr.slice(offset || 0, limit);
});
cfg.addPlugin(syntaxHighlight);
cfg.addPlugin(pluginRss);
cfg.addFilter("cssmin", function (code) {
return new CleanCSS({}).minify(code).styles;
});
return {
dir: {
input: "src",
output: "build",
},
};
};