-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eleventy.js
42 lines (34 loc) · 1.12 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
let env = process.env.ELEVENTY_ENV
// RSS imports
const absoluteUrl = require("@11ty/eleventy-plugin-rss/src/absoluteUrl")
// Date and time
const { DateTime } = require("luxon")
module.exports = function (eleventyConfig) {
eleventyConfig.addFilter("htmlDateString", (dateObj) => {
return DateTime.fromJSDate(dateObj, { zone: "utc" }).toFormat("yyyy-LL-dd")
})
eleventyConfig.addNunjucksFilter("absoluteUrl", (href, base) =>
absoluteUrl(href, base),
)
// compress and combine js files
eleventyConfig.addFilter("jsmin", require("./utils/minify-js.js"))
// minify the html output when running in prod
if (process.env.NODE_ENV == "production") {
eleventyConfig.addTransform("htmlmin", require("./utils/minify-html.js"))
}
// Copy over folders with static assets e.g. images
eleventyConfig.addPassthroughCopy("assets/images")
eleventyConfig.addPassthroughCopy("assets/js")
eleventyConfig.addPassthroughCopy({
public: "/",
})
return {
dir: {
input: ".",
output: "dist",
},
passthroughFileCopy: true,
templateFormats: ["njk", "md"],
htmlTemplateEngine: "njk",
}
}