Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

generate all asset aspect ratios on build #736

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

JoeKarow
Copy link
Member

@JoeKarow JoeKarow commented Oct 30, 2022

Linked Issue

Closes #678

Description

Build script that generates aspect ratio definitions for all images in the public/assets directory. The script will also generate a Union Type of the SVG file names for use in the UndrawIllustration component.

Methodology Random GIF

Code of Conduct

By submitting this pull request, you agree to follow our Code of Conduct

@netlify
Copy link

netlify bot commented Oct 30, 2022

👷 Deploy Preview for virtual-coffee-io processing.

Name Link
🔨 Latest commit ba5b2a0
🔍 Latest deploy log https://app.netlify.com/sites/virtual-coffee-io/deploys/63878545171e010008db2f54

@JoeKarow JoeKarow marked this pull request as ready for review October 30, 2022 22:21
@danieltott
Copy link
Member

@JoeKarow still looking at this one, but added hacktoberfest-accepted 👍🏼

Copy link
Member

@danieltott danieltott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey Joe -

Still working through this a bit and got stock on a weird eslint thing. See below...

'.webp',
];

const getFiles = async (dir: string) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JoeKarow I'm getting an eslint error here.

It looks like there's some weirdness with eslint/typescript and mts files.

I think there's something we can do about it but it might take some research.

We use @remix-run/eslint-config which in turn uses typescript-eslint (among other things).

There's a spot in remix's config where they list file types, and I can see mts is not included there:

https://github.com/remix-run/remix/blob/8f7100b2d5c40d5b2f0856958898cab70ef9d407/packages/remix-eslint-config/settings/import.js#L4

This is as far as I got. It's possible we can add/adjust our eslint config to allow for this - I'm not exactly sure what that looks like.

const outputFile = path.resolve('app/_generatedData/aspectRatios.ts');
const inputDir = path.resolve('public/assets');

const supportedTypes = [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since we're using this to check file extensions as opposed to looking at the file contents, I think we should rename this supportedExtensions

We also should add '.jpg'

@danieltott
Copy link
Member

@JoeKarow are you still interested in working through this? I know it's been a while. No worries if you're not interested anymore. There have been some updates to the site and the dependencies that might have resolved some of the issues we were having, it's possible catching this branch up will fix that eslint issue. Let me know one way or the other, no worries if you'd like to pass it off.

@JoeKarow
Copy link
Member Author

JoeKarow commented Jun 6, 2023

@danieltott I've been SWAMPED with work - if someone else could take this over, I'd be appreciative!

@BekahHW
Copy link
Member

BekahHW commented Oct 18, 2023

@danieltott is this still something that needs worked on?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Auto-generate SVG aspect ratios
3 participants