From 9c30877754fbdfeff375ed2a75f63df8620d9a4e Mon Sep 17 00:00:00 2001 From: Wes Dean Date: Fri, 2 Aug 2024 11:57:14 -0400 Subject: [PATCH] Clean up the config file... again? --- config/index.js | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/config/index.js b/config/index.js index 0ebc3e46..611eb1e0 100644 --- a/config/index.js +++ b/config/index.js @@ -1,41 +1,35 @@ -const path = require('path'); -const Image = require('@11ty/eleventy-img'); - -async function imageWithClassShortcode( - src, - cls, - alt, - containFit -) { - let pathPrefix = ''; +const path = require("path"); +const Image = require("@11ty/eleventy-img"); + +async function imageWithClassShortcode(src, cls, alt, containFit) { + let pathPrefix = ""; let style; if (process.env.BASEURL) { - pathPrefix = process.env.BASEURL + pathPrefix = process.env.BASEURL; } const ext = path.extname(src); - const fileType = ext.replace('.', ''); + const fileType = ext.replace(".", ""); const metadata = await Image(src, { formats: [fileType], - outputDir: './_site/img/', + outputDir: "./_site/img/", }); const data = metadata[fileType] ? metadata[fileType][0] : metadata.jpeg[0]; - + if (containFit) { style = 'style="object-fit:contain;"'; } return `${alt}`; -}; - +} async function imageShortcode(src, alt) { - return await imageWithClassShortcode(src, '', alt) -}; + return await imageWithClassShortcode(src, "", alt); +} module.exports = { imageWithClassShortcode, - imageShortcode -} + imageShortcode, +};