-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eleventy.js
64 lines (52 loc) · 1.85 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
const markdownIt = require("markdown-it");
const markdownItAnchor = require("markdown-it-anchor");
const syntaxHighlight = require("@11ty/eleventy-plugin-syntaxhighlight");
const moment = require("moment");
module.exports = function (eleventyConfig) {
// Copy `assets/` to `_site/assets`
eleventyConfig.addPassthroughCopy("assets");
eleventyConfig.addFilter("dateIso", date => {
return moment(date).utc().format("LL"); // May 31, 2019
});
// excerpt parsing
eleventyConfig.setFrontMatterParsingOptions({
excerpt: true,
// Optional, default is "---"
excerpt_separator: "<!--more-->"
});
eleventyConfig.addShortcode("listFunction", function (list) {
return list
.map(item => {
return `<span class="text-sm mr-2 mb-2 inline-block text-gray-800 bg-gray-900 bg-opacity-10 rounded px-2">${item}</span>`;
})
.join(" ");
});
//syntax highlight
eleventyConfig.addPlugin(syntaxHighlight);
/* Markdown Overrides */
let markdownLibrary = markdownIt({
html: true,
breaks: true,
linkify: true
}).use(markdownItAnchor, {
permalink: true,
permalinkClass: "direct-link",
permalinkSymbol: "#"
});
eleventyConfig.setLibrary("md", markdownLibrary);
eleventyConfig.setServerOptions({
// Default values are shown:
// Whether the live reload snippet is used
liveReload: true,
// Whether DOM diffing updates are applied where possible instead of page reloads
domDiff: true,
// The starting port number
// Will increment up to (configurable) 10 times if a port is already in use.
port: 8080,
// Additional files to watch that will trigger server updates
// Accepts an Array of file paths or globs (passed to `chokidar.watch`).
// Works great with a separate bundler writing files to your output folder.
// e.g. `watch: ["_site/**/*.css"]`
watch: ["_site/**/*.css"],
});
};