Skip to content

Instantly share code, notes, and snippets.

@vladdancer
Created June 3, 2022 21:45
Show Gist options
  • Save vladdancer/51623fde404afd566462b005d9b28fd0 to your computer and use it in GitHub Desktop.
Save vladdancer/51623fde404afd566462b005d9b28fd0 to your computer and use it in GitHub Desktop.
PP Media template example
{% if pp_media.asset.meta.type === 'image' %}
{{ attach_library('easy_responsive_images/resizer') }}
{% set srcset = [
asset.sizes['400w'].url ~ ' 600w',
asset.sizes['900w'].url ~ ' 900w',
asset.sizes['3000w'].url ~ ' 3000w',
] %}
<img src="{{ src }}" data-srcset="{{ srcset|join(',')|raw }}" alt="{{ pp_media.asset.meta.alt }}" loading="lazy" />
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment