-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheleventy.config.js
More file actions
66 lines (57 loc) · 2.16 KB
/
eleventy.config.js
File metadata and controls
66 lines (57 loc) · 2.16 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
const highlightjs = require("highlight.js");
const nunjucks = require("nunjucks");
module.exports = function configuration(eleventyConfig) {
// Watch source Sass/JS files so Eleventy can trigger browser reloads when
// assets are rebuilt by external watchers.
eleventyConfig.setUseGitIgnore(false);
eleventyConfig.addWatchTarget("./styles/");
eleventyConfig.addWatchTarget("./scripts/");
eleventyConfig.addWatchTarget("../toolkit/core/");
eleventyConfig.addWatchTarget("../toolkit/components/");
eleventyConfig.addWatchTarget("../toolkit/ofh.scss");
eleventyConfig.addWatchTarget("../toolkit/assets/");
// Note: ../toolkit/dist/ is handled by passthrough copy and doesn't need watching
// Documentation assets e.g. images, PDFs.
eleventyConfig.addPassthroughCopy({ assets: "assets" });
eleventyConfig.addPassthroughCopy({ components: "components" });
eleventyConfig.addPassthroughCopy({
"../toolkit/assets/icons/icon-sprite.svg": "assets/icons/icon-sprite.svg",
});
// Toolkit CSS & JavaScript assets.
// These compiled toolkit assets are used by `views/_includes/standalone-example-layout.njk`.
// The bundle task now includes assets (logos, favicons, icons) in dist/assets/.
eleventyConfig.addPassthroughCopy({
"../toolkit/dist": "ofh-design-system-toolkit",
});
// iframe-resizer is used by the isolated design examples (loaded in iframes).
eleventyConfig.addPassthroughCopy({
"node_modules/iframe-resizer/": "iframe-resizer",
});
// Prevent the output of toolkit CSS and JS assets in watch mode
// triggering multiple rebuilds of the docs site.
eleventyConfig.setWatchThrottleWaitTime(300);
const nunjucksEnv = nunjucks.configure(
[
"views/",
"views/_includes/",
"./",
"../toolkit/components/",
"../toolkit/",
],
{
watch: false,
noCache: true,
},
);
eleventyConfig.setLibrary("njk", nunjucksEnv);
eleventyConfig.addFilter("highlight", (code, language) => {
const languages = language ? [language] : false;
return highlightjs.highlightAuto(code.trim(), languages).value;
});
return {
dir: {
input: "views/",
output: "dist/",
},
};
};