Skip to content

Instantly share code, notes, and snippets.

@qq7
Created January 4, 2018 21:21
Show Gist options
  • Save qq7/48d8265474b14336a891cebbf21447dd to your computer and use it in GitHub Desktop.
Save qq7/48d8265474b14336a891cebbf21447dd to your computer and use it in GitHub Desktop.
<img src="{{ image.src | img_url: '480x' }}" alt="{{ image.alt | escape }}"
srcset="
{% if image.width > 640 %}{{ image.src | img_url: '640x' }} 640w{% endif %}
{% if image.width > 720 %},{{ image.src | img_url: '720x' }} 720w{% endif %}
{% if image.width > 900 %},{{ image.src | img_url: '900x' }} 900w{% endif %}
"
sizes="(min-width: 960px) 450px, (min-width: 720px) 50vw, 100vw"
/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment