Skip to content

feat(picture): support sizes attribute#482

Merged
oscarotero merged 4 commits intolumeland:masterfrom
cawa-93:responsive-images
Sep 5, 2023
Merged

feat(picture): support sizes attribute#482
oscarotero merged 4 commits intolumeland:masterfrom
cawa-93:responsive-images

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, img-100w@2.png 2x"/>
	<img src="img.png" />
</picture>

After this change:

<picture>
	<source srcset="img-100w.png 100w, img-100w@2.png 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.

@oscarotero oscarotero merged commit 8cc1dfe into lumeland:master Sep 5, 2023
@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