Revert "chore: only generate og images locally"

This reverts commit 362afdb588.
This commit is contained in:
Cory Dransfeldt 2024-05-01 18:17:52 -07:00
parent 362afdb588
commit cbf9a40667
No known key found for this signature in database
299 changed files with 23 additions and 31 deletions

View file

@ -3,29 +3,26 @@ import Image from '@11ty/eleventy-img'
import { minify } from 'terser'
export const svgToJpeg = () => {
if (process.env.ELEVENTY_RUN_MODE !== 'build') {
const socialPreviewImagesInputDir = '_site/assets/img/social-preview/'
const socialPreviewImagesOutputDir = 'src/assets/img/social-preview/'
fs.readdir(socialPreviewImagesInputDir, (err, files) => {
if (!!files && files.length > 0) {
files.forEach((fileName) => {
if (fileName.endsWith('.svg')) {
let imageUrl = socialPreviewImagesInputDir + fileName
Image(imageUrl, {
formats: ['jpeg'],
outputDir: './' + socialPreviewImagesOutputDir,
filenameFormat: function (id, src, width, format) {
let outputFileName = fileName.substring(0, fileName.length - 4)
return `${outputFileName}.${format}`
},
})
}
})
} else {
console.log('⚠ No social images found')
}
})
}
const socialPreviewImagesDir = '_site/assets/img/social-preview/'
fs.readdir(socialPreviewImagesDir, (err, files) => {
if (!!files && files.length > 0) {
files.forEach((fileName) => {
if (fileName.endsWith('.svg')) {
let imageUrl = socialPreviewImagesDir + fileName
Image(imageUrl, {
formats: ['jpeg'],
outputDir: './' + socialPreviewImagesDir,
filenameFormat: function (id, src, width, format) {
let outputFileName = fileName.substring(0, fileName.length - 4)
return `${outputFileName}.${format}`
},
})
}
})
} else {
console.log('⚠ No social images found')
}
})
}
export const minifyJsComponents = async () => {