-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.eleventy.js
More file actions
31 lines (27 loc) · 797 Bytes
/
.eleventy.js
File metadata and controls
31 lines (27 loc) · 797 Bytes
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
module.exports = function(eleventyConfig) {
eleventyConfig.addPassthroughCopy("./static/images");
eleventyConfig.addPassthroughCopy("./**./**/*.{jpg,png,svg}");
return {
dir: {
// default: [site root]
input: "static",
// default: _site
output: "_site",
},
};
};
async function imageShortcode(src, alt, sizes) {
let metadata = await Image(path.join(__dirname, src), {
outputDir: "./_site/images/",
urlPath: "/_site/images",
widths: [300, 600, 900, 1200],
formats: ["avif", "webp", "jpg", "png"],
});
let imageAttributes = {
alt,
sizes,
loading: "lazy",
decoding: "async",
};
return Image.generateHTML(metadata, imageAttributes);
}