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

Preserve the class attribute on fallback IMG in PICTURE #67

Closed

Conversation

sque89
Copy link

@sque89 sque89 commented Jan 17, 2024

When using <picture> some styles still need to be applied on the <img>. One example would be object-fit. So we need a way to provide a CSS class to the fallack <img> inside the picture to apply those styles to it.

This MR checks if a class attribute is available and if so, preserves it on the <img>.

Usage: post.thumbnail|get_timber_picture_responsive($image_size, {class: 'theClass'}) which will set the class attribute of <img> to theClass

@sque89
Copy link
Author

sque89 commented Aug 23, 2024

Hi @gchtr, do you think this can be merged anytime soon? Thanks a lot!

@gchtr
Copy link
Member

gchtr commented Aug 27, 2024

@sque89 I added a test and documentation for this in #84 and merged it in.

I also renamed the argument from class to img_class. I did this because in the future, there might be a function that also adds the <picture> tag. There, we could also have a class argument and we would have to discern between the class for the <picture> and the class for the <img> tag.

@gchtr gchtr closed this Aug 27, 2024
@gchtr
Copy link
Member

gchtr commented Aug 30, 2024

This is now released in https://github.com/mindkomm/timmy/releases/tag/v2.1.0.

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

Successfully merging this pull request may close these issues.

2 participants