-
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy path.eleventy.js
More file actions
86 lines (76 loc) · 2.41 KB
/
.eleventy.js
File metadata and controls
86 lines (76 loc) · 2.41 KB
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import lightningcssPlugin from "@11tyrocks/eleventy-plugin-lightningcss";
import syntaxHighlight from "@11ty/eleventy-plugin-syntaxhighlight";
import markdownItDirective from "markdown-it-directive";
import previewMarkdownDirective from "./11tyconfig/previewMarkdownDirective.js";
export default function (eleventyConfig) {
const now = String(Date.now());
eleventyConfig.addShortcode("version", function () {
return now;
});
// === IGNORES ===
eleventyConfig.ignores.add("site/README.md");
// === COLLECTIONS ===
eleventyConfig.addCollection("component", function (collectionApi) {
return collectionApi
.getFilteredByGlob("site/component-library/**/*")
.sort((a, b) => {
return a.data.title.localeCompare(b.data.title);
});
});
// === PASSTHROUGH COPY ===
// Copy the Roux framework styles to _site
eleventyConfig.addPassthroughCopy("src/css/");
// Copy site-specific assets to _site
eleventyConfig.addPassthroughCopy("site/assets/");
// meta icons
eleventyConfig.addPassthroughCopy("site/*.ico");
eleventyConfig.addPassthroughCopy("site/*.svg");
eleventyConfig.addPassthroughCopy("site/*.png");
// metadata
eleventyConfig.addPassthroughCopy("site/robots.txt");
// minify CSS with LightningCSS
// Process Roux framework CSS, site-specific CSS, and component preview CSS
eleventyConfig.addPlugin(lightningcssPlugin, [
{
src: "src/css/app.css",
lightningcssOptions: {
minify: true,
sourceMap: true,
targets: "defaults",
},
},
{
src: "site/assets/css/site.css",
lightningcssOptions: {
minify: true,
sourceMap: true,
targets: "defaults",
},
},
{
src: "site/assets/css/component-preview.css",
lightningcssOptions: {
minify: true,
sourceMap: true,
targets: "defaults",
},
},
]);
// syntax highlighting for code blocks
eleventyConfig.addPlugin(syntaxHighlight, { preAttributes: { tabindex: 0 } });
// Configure markdown-it with directive support
eleventyConfig.amendLibrary("md", (mdLib) => {
mdLib.use(markdownItDirective).use(previewMarkdownDirective);
return mdLib;
});
const config = {
dir: {
input: "site",
output: "_site",
},
};
// support .md and .njk template engines in same files
config.markdownTemplateEngine = "njk";
config.htmlTemplateEngine = "njk";
return config;
}