Skip to content

Commit b58b2fe

Browse files
committed
Format
1 parent 3affc8f commit b58b2fe

File tree

1 file changed

+48
-48
lines changed

1 file changed

+48
-48
lines changed

.eleventy.js

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ const {
1919

2020
const media_filetypes = "jpg,jpeg,JPG,png,gif,svg,avif";
2121

22-
module.exports = function(eleventyConfig) {
22+
module.exports = function (eleventyConfig) {
2323
// Configure markdown parser
24-
const markdownLib = markdownIt({html: true, typographer: true});
24+
const markdownLib = markdownIt({ html: true, typographer: true });
2525
markdownLib.use(markdownItAnchor);
2626
markdownLib.use(markdownItAttrs);
27-
27+
2828
eleventyConfig.setLibrary("md", markdownLib);
2929
eleventyConfig.addPlugin(fortawesomeBrandsPlugin);
3030
eleventyConfig.addPlugin(syntaxHighlight);
@@ -38,8 +38,8 @@ module.exports = function(eleventyConfig) {
3838
eleventyConfig.addPassthroughCopy("favicon.png");
3939
eleventyConfig.addPassthroughCopy("galleries/**/*." + media_filetypes);
4040
eleventyConfig.addPassthroughCopy("google5458abc1104b04dd.html");
41-
eleventyConfig.addPassthroughCopy({"htaccess": ".htaccess"});
42-
eleventyConfig.addPassthroughCopy({"content": "."}, {
41+
eleventyConfig.addPassthroughCopy({ "htaccess": ".htaccess" });
42+
eleventyConfig.addPassthroughCopy({ "content": "." }, {
4343
filter: ["**/*." + + media_filetypes],
4444
rename: function (path) {
4545
return path.replace("content/", "");
@@ -49,7 +49,7 @@ module.exports = function(eleventyConfig) {
4949
eleventyConfig.addWatchTarget("src/**/*");
5050
let $collectionApi = null;
5151

52-
eleventyConfig.addCollection("posts", function(collectionApi) {
52+
eleventyConfig.addCollection("posts", function (collectionApi) {
5353
$collectionApi = collectionApi;
5454
return collectionApi.getFilteredByGlob("_posts/*.md");
5555
});
@@ -58,55 +58,55 @@ module.exports = function(eleventyConfig) {
5858
dynamicPartials: false,
5959
});
6060

61-
eleventyConfig.addFilter("cssmin", function(code) {
61+
eleventyConfig.addFilter("cssmin", function (code) {
6262
return new CleanCSS({}).minify(code).styles;
6363
});
6464

65-
eleventyConfig.addShortcode("image", async function(src, alt, sizes) {
65+
eleventyConfig.addShortcode("image", async function (src, alt, sizes) {
6666
let metadata = await fetch_image(src);
6767

68-
let imageAttributes = {
69-
alt,
70-
sizes,
71-
loading: "lazy",
72-
decoding: "async",
73-
};
68+
let imageAttributes = {
69+
alt,
70+
sizes,
71+
loading: "lazy",
72+
decoding: "async",
73+
};
7474

75-
// You bet we throw an error on a missing alt (alt="" works okay)
76-
return Image.generateHTML(metadata, imageAttributes);
77-
});
75+
// You bet we throw an error on a missing alt (alt="" works okay)
76+
return Image.generateHTML(metadata, imageAttributes);
77+
});
7878

79-
eleventyConfig.addShortcode("img_responsive", async function(src, alt, sizes="100vw, 720, 820, 940, 1140, 1280") {
79+
eleventyConfig.addShortcode("img_responsive", async function (src, alt, sizes = "100vw, 720, 820, 940, 1140, 1280") {
8080
let metadata = await fetch_image(src);
81-
let imageAttributes = {
82-
alt,
83-
sizes,
81+
let imageAttributes = {
82+
alt,
83+
sizes,
8484
class: "img-responsive",
85-
loading: "lazy",
86-
decoding: "async",
87-
};
85+
loading: "lazy",
86+
decoding: "async",
87+
};
8888

89-
return Image.generateHTML(metadata, imageAttributes);
89+
return Image.generateHTML(metadata, imageAttributes);
9090
});
9191

92-
eleventyConfig.addShortcode("image_with_class", async function(src, alt, sizes, class_names) {
92+
eleventyConfig.addShortcode("image_with_class", async function (src, alt, sizes, class_names) {
9393
let metadata = await fetch_image(src);
9494

95-
if (sizes==undefined || sizes=="_") {
96-
sizes="720, 940, 1140, 1280, 2048";
95+
if (sizes == undefined || sizes == "_") {
96+
sizes = "720, 940, 1140, 1280, 2048";
9797
}
9898

99-
let imageAttributes = {
100-
alt,
101-
sizes,
99+
let imageAttributes = {
100+
alt,
101+
sizes,
102102
class: class_names,
103-
loading: "lazy",
104-
decoding: "async",
105-
};
103+
loading: "lazy",
104+
decoding: "async",
105+
};
106106

107-
// You bet we throw an error on a missing alt (alt="" works okay)
108-
return Image.generateHTML(metadata, imageAttributes);
109-
});
107+
// You bet we throw an error on a missing alt (alt="" works okay)
108+
return Image.generateHTML(metadata, imageAttributes);
109+
});
110110

111111
// Thumbnails
112112
eleventyConfig.addShortcode("thumbnail_for_post", thumbnails.thumbnail_for_post);
@@ -124,15 +124,15 @@ module.exports = function(eleventyConfig) {
124124
});
125125

126126
// Liquid filter to convert a date to a string
127-
eleventyConfig.addLiquidFilter("to_utc_string", date => date.toUTCString() );
127+
eleventyConfig.addLiquidFilter("to_utc_string", date => date.toUTCString());
128128

129129
// Liquid filter for long date string
130-
eleventyConfig.addLiquidFilter("date_to_long_string", function(date) {
130+
eleventyConfig.addLiquidFilter("date_to_long_string", function (date) {
131131
return date.toLocaleDateString("en-GB", { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' });
132132
});
133133

134134
// Universal filter for jsonify
135-
eleventyConfig.addFilter("jsonify", JSON.stringify );
135+
eleventyConfig.addFilter("jsonify", JSON.stringify);
136136

137137
eleventyConfig.addFilter("with_explicit_date", items => items.filter(item => "date" in item.data));
138138

@@ -142,14 +142,14 @@ module.exports = function(eleventyConfig) {
142142

143143
// Read the menu data from _config.yml and add it to the global data
144144
eleventyConfig.addGlobalData("menu", () => getDataFromConfigYaml("menu"));
145-
eleventyConfig.addGlobalData("site_title", () => getDataFromConfigYaml("title"));
146-
eleventyConfig.addGlobalData("site_tagline", () => getDataFromConfigYaml("tagline"));
147-
eleventyConfig.addGlobalData("production_url", () => getDataFromConfigYaml("production_url"));
148-
eleventyConfig.addGlobalData("JB", () => getDataFromConfigYaml("JB"));
149-
eleventyConfig.addGlobalData("author", () => getDataFromConfigYaml("author"));
150-
eleventyConfig.addGlobalData("now" , () => new Date());
151-
152-
eleventyConfig.addNunjucksFilter("date", function(date, format) {
145+
eleventyConfig.addGlobalData("site_title", () => getDataFromConfigYaml("title"));
146+
eleventyConfig.addGlobalData("site_tagline", () => getDataFromConfigYaml("tagline"));
147+
eleventyConfig.addGlobalData("production_url", () => getDataFromConfigYaml("production_url"));
148+
eleventyConfig.addGlobalData("JB", () => getDataFromConfigYaml("JB"));
149+
eleventyConfig.addGlobalData("author", () => getDataFromConfigYaml("author"));
150+
eleventyConfig.addGlobalData("now", () => new Date());
151+
152+
eleventyConfig.addNunjucksFilter("date", function (date, format) {
153153
return moment(date).format(format);
154154
});
155155

0 commit comments

Comments
 (0)