-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.eleventy.js
56 lines (46 loc) · 1.86 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
require("dotenv").config();
const generatePermalinkDate = require("./src/_lib/generatePermalinkDate");
const generateMinifiedPath = require("./src/_lib/generateMinifiedPath");
const minifyInlineScripts = require("./src/_lib/minifyInlineScripts");
module.exports = function (eleventyConfig) {
// Pass items through to /dist
eleventyConfig.addPassthroughCopy("src/images");
eleventyConfig.addPassthroughCopy({ "src/_copied/fonts": "fonts" });
eleventyConfig.addPassthroughCopy({ "src/_copied/css/*.css": "css" });
eleventyConfig.addPassthroughCopy(".well-known/*.txt");
eleventyConfig.addPassthroughCopy("robots.txt");
eleventyConfig.addPassthroughCopy("_headers");
eleventyConfig.addPassthroughCopy("_routes.json");
eleventyConfig.addPassthroughCopy({
"google2604c2a182173f8d.html": "google2604c2a182173f8d.html",
});
// Don't minify JS if we're not in production
if (process.env.ENVIRONMENT !== "production") {
eleventyConfig.addPassthroughCopy({ "src/_includes/js/*.js": "js" });
}
// Synchronous filters
eleventyConfig.addFilter("generatePermalinkDate", generatePermalinkDate);
eleventyConfig.addFilter("generateMinifiedPath", generateMinifiedPath);
// Asynchronous filters
eleventyConfig.addNunjucksAsyncFilter(
"minifyInlineScripts",
minifyInlineScripts
);
// Short codes
eleventyConfig.addShortcode("year", () => `${new Date().getFullYear()}`);
// Environment variable
eleventyConfig.addGlobalData("env", process.env);
return {
dir: {
input: "src",
output: "dist",
},
// Control which files Eleventy will process
// e.g.: *.md, *.njk, *.html, *.liquid
templateFormats: ["md", "njk", "html", "11ty.js"],
// Pre-process *.md files with: (default: `liquid`)
markdownTemplateEngine: "njk",
// Pre-process *.html files with: (default: `liquid`)
htmlTemplateEngine: "njk",
};
};