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

feat(picture): support sizes attribute #482

Merged
merged 4 commits into from
Sep 5, 2023

Conversation

cawa-93
Copy link
Contributor

@cawa-93 cawa-93 commented Sep 5, 2023

Description

Add support for responsive images generated by picture plugin.

  1. Width dimension descriptors are provided instead of pixel ratio values (200w instead of 2x for example) if image has sizes attribute.
  2. sizes attribute preserved and passed for all sources

Source code:

<img src="img.png" imagick="100@2" sizes="(width < 700px) 100px, 200px"/>

Before this change:

<picture>
	<source srcset="img-100w.png, [email protected] 2x"/>
	<img src="img.png" />
</picture>

After this change:

<picture>
	<source srcset="img-100w.png 100w, [email protected] 200w"  sizes="(width < 700px) 100px, 200px"/>
	<img src="img.png" />
</picture>

Check List

  • Have you read the
    CODE OF CONDUCT
  • Have you read the document
    CONTRIBUTING
    • One pull request per feature. If you want to do more than one thing,
      send multiple pull request.
    • Write tests.
    • Run deno fmt to fix the code format before commit.
    • Document any change in the CHANGELOG.md.

plugins/picture.ts Outdated Show resolved Hide resolved
@oscarotero oscarotero merged commit 8cc1dfe into lumeland:master Sep 5, 2023
3 checks passed
@oscarotero
Copy link
Member

Thank you!

@cawa-93 cawa-93 deleted the responsive-images branch September 5, 2023 14:55
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