-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eleventy.js
32 lines (25 loc) · 1.01 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
const moment = require("moment");
const CleanCSS = require("clean-css");
const syntaxHighlight = require("@11ty/eleventy-plugin-syntaxhighlight");
const { DateTime } = require("luxon");
moment.locale("en");
module.exports = function (eleventyConfig) {
eleventyConfig.addFilter("dateIso", (date) => {
return moment(date).toISOString();
});
eleventyConfig.addFilter("dateReadable", (date) => {
return moment(date).utc().format("LL"); // E.g. May 31, 2019
});
eleventyConfig.addFilter("cssmin", function (code) {
return new CleanCSS({}).minify(code).styles;
});
eleventyConfig.addFilter("postDate", (dateObj) => {
return DateTime.fromJSDate(dateObj).toLocaleString();
});
eleventyConfig.addPassthroughCopy("assets/fonts");
eleventyConfig.addPlugin(syntaxHighlight);
const markdownIt = require("markdown-it");
const markdownItAnchor = require("markdown-it-anchor");
const markdownLib = markdownIt({ html: true }).use(markdownItAnchor);
eleventyConfig.setLibrary("md", markdownLib);
};