-
Notifications
You must be signed in to change notification settings - Fork 6
/
.eleventy.js
65 lines (55 loc) · 2.06 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
65
const pluginBookshop = require("@bookshop/eleventy-bookshop");
const yaml = require("js-yaml");
const svgContents = require("eleventy-plugin-svg-contents");
const esbuild = require('esbuild');
/* 11ty config imports */
const image_shortcode = require('./_11ty_config/image_shortcode')
const military_time = require('./_11ty_config/military_time_filter')
const assign_local_liquid_tag = require('./_11ty_config/assign_local_liquid_tag')
const contains_block_filter = require('./_11ty_config/contains_block_filter')
const MarkdownIt = require("markdown-it"),
md = new MarkdownIt({
html: true,
});
module.exports = function (eleventyConfig) {
eleventyConfig.addPassthroughCopy("src/assets/fonts");
eleventyConfig.addPassthroughCopy("src/assets/images");
eleventyConfig.addPassthroughCopy("src/assets/uploads");
eleventyConfig.addPassthroughCopy("css")
// Data extensions
eleventyConfig.addDataExtension("yaml", (contents) => yaml.load(contents));
eleventyConfig.addDataExtension("yml", (contents) => yaml.load(contents));
// Custom shortcodes
eleventyConfig.addShortcode("image", image_shortcode);
eleventyConfig.addWatchTarget("component-library/");
// Plugins
eleventyConfig.addPlugin(svgContents);
eleventyConfig.addPlugin(pluginBookshop({
bookshopLocations: ["component-library"],
pathPrefix: '',
}));
// Filters
eleventyConfig.addFilter("markdownify", (markdown) => md.render(markdown));
eleventyConfig.addFilter("ymlify", (yml) => yaml.load(yml));
eleventyConfig.addFilter("militaryTime", military_time);
eleventyConfig.addFilter('contains_block', contains_block_filter);
// Tags
eleventyConfig.addLiquidTag('assign_local', assign_local_liquid_tag);
// esbuild
eleventyConfig.addWatchTarget('./src/assets/js/**');
eleventyConfig.on('eleventy.before', async () => {
await esbuild.build({
entryPoints: ['src/assets/js/**'],
outdir: '_site/assets/js',
bundle: true,
minify: true,
sourcemap: true,
});
});
return {
dir: {
input: "src",
output: "_site"
}
}
}