-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
.eleventy.js
45 lines (40 loc) · 1021 Bytes
/
.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
const fs = require('fs');
const yaml = require("js-yaml");
const esbuild = require("esbuild");
function bundle() {
esbuild.buildSync({
entryPoints: ['./assets/editor.js'],
bundle: true,
outfile: './dist/editor.js',
minify: process.env.NODE_ENV === 'production'
})
}
fs.mkdirSync('./dist', {recursive: true});
fs.copyFileSync('./node_modules/alpinejs/dist/alpine.js', './dist/alpine.js');
bundle()
module.exports = function(eleventyConfig) {
eleventyConfig.addDataExtension("yaml", contents => yaml.load(contents));
eleventyConfig.addWatchTarget("./assets");
eleventyConfig.addTransform('bundle', (content) => {
bundle();
return content;
});
return {
templateFormats: [
"md",
"njk",
"html",
// "liquid",
"js"
],
// markdownTemplateEngine: "liquid",
htmlTemplateEngine: "njk",
dataTemplateEngine: "njk",
dir: {
input: "./pages",
includes: "../_includes",
data: "../_data",
output: "dist"
}
};
};