Skip to content

Commit

Permalink
Fixed prettier complaints
Browse files Browse the repository at this point in the history
Signed-off-by: George Araújo <george.gcac@gmail.com>
  • Loading branch information
george-gca committed Jan 28, 2024
1 parent 6f7e4c8 commit 1521333
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 64 deletions.
124 changes: 62 additions & 62 deletions _includes/figure.liquid
Original file line number Diff line number Diff line change
@@ -1,69 +1,69 @@
{% assign img_path = include.path | remove: '.jpg' | remove: '.jpeg' | remove: '.png' | remove: '.tiff' | remove: '.gif' %}

{% if include.slot %}
<figure slot="{{ include.slot }}">
{% else %}
<figure>
{% endif %}
<picture>
<!-- Auto scaling with imagemagick -->
<!--
See https://www.debugbear.com/blog/responsive-images#w-descriptors-and-the-sizes-attribute and
https://developer.mozilla.org/en-US/docs/Learn/HTML/Multimedia_and_embedding/Responsive_images for info on defining 'sizes' for responsive images
-->
{% if site.imagemagick.enabled %}
<source
class="responsive-img-srcset"
srcset="{% for i in site.imagemagick.widths %}{{ img_path | relative_url }}-{{ i }}.webp {{i}}w,{% endfor %}"
{% if include.sizes %}
sizes="{{include.sizes}}"
{% else %}
sizes="95vw"
{% endif %}
type="image/webp"
>
{% endif %}
<img
src="{% if include.cache_bust %}{{ include.path | relative_url | bust_file_cache }}{% else %}{{ include.path | relative_url }}{% endif %}"
{% if include.class %}
class="{{ include.class }}"
{% endif %}
{% if include.width %}
width="{{ include.width }}"
{% else %}
width="100%"
{% endif %}
{% if include.height %}
height="{{ include.height }}"
<figure
{% if include.slot %}
slot="{{ include.slot }}"
{% endif %}
>
<picture>
<!-- Auto scaling with imagemagick -->
<!--
See https://www.debugbear.com/blog/responsive-images#w-descriptors-and-the-sizes-attribute and
https://developer.mozilla.org/en-US/docs/Learn/HTML/Multimedia_and_embedding/Responsive_images for info on defining 'sizes' for responsive images
-->
{% if site.imagemagick.enabled %}
<source
class="responsive-img-srcset"
srcset="{% for i in site.imagemagick.widths %}{{ img_path | relative_url }}-{{ i }}.webp {{i}}w,{% endfor %}"
{% if include.sizes %}
sizes="{{include.sizes}}"
{% else %}
height="auto"
{% endif %}
{% if include['min-width'] %}
min-width="{{ include.min-width }}"
{% endif %}
{% if include['min-height'] %}
min-height="{{ include.min-height }}"
sizes="95vw"
{% endif %}
{% if include['max-width'] %}
max-width="{{ include.max-width }}"
{% endif %}
{% if include['max-height'] %}
max-height="{{ include.max-height }}"
{% endif %}
{% if include.alt %}
alt="{{ include.alt }}"
{% endif %}
{% if include.title %}
title="{{ include.title }}"
{% endif %}
{% if include.zoomable %}
data-zoomable
{% endif %}
onerror="this.onerror=null; $('.responsive-img-srcset').remove();"
type="image/webp"
>
</picture>

{% if include.caption %}
<figcaption class="caption">{{ include.caption }}</figcaption>
{% endif %}
<img
src="{% if include.cache_bust %}{{ include.path | relative_url | bust_file_cache }}{% else %}{{ include.path | relative_url }}{% endif %}"
{% if include.class %}
class="{{ include.class }}"
{% endif %}
{% if include.width %}
width="{{ include.width }}"
{% else %}
width="100%"
{% endif %}
{% if include.height %}
height="{{ include.height }}"
{% else %}
height="auto"
{% endif %}
{% if include['min-width'] %}
min-width="{{ include.min-width }}"
{% endif %}
{% if include['min-height'] %}
min-height="{{ include.min-height }}"
{% endif %}
{% if include['max-width'] %}
max-width="{{ include.max-width }}"
{% endif %}
{% if include['max-height'] %}
max-height="{{ include.max-height }}"
{% endif %}
{% if include.alt %}
alt="{{ include.alt }}"
{% endif %}
{% if include.title %}
title="{{ include.title }}"
{% endif %}
{% if include.zoomable %}
data-zoomable
{% endif %}
onerror="this.onerror=null; $('.responsive-img-srcset').remove();"
>
</picture>

{% if include.caption %}
<figcaption class="caption">{{ include.caption }}</figcaption>
{% endif %}
</figure>
7 changes: 6 additions & 1 deletion _includes/head.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/img-comparison-slider@8.0/dist/styles.min.css">
{% endif %}
{% if page.images.slider %}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/swiper@11.0.5/swiper-bundle.min.css" integrity="sha256-yUoNxsvX+Vo8Trj3lZ/Y5ZBf8HlBFsB6Xwm7rH75/9E=" crossorigin="anonymous">
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/swiper@11.0.5/swiper-bundle.min.css"
integrity="sha256-yUoNxsvX+Vo8Trj3lZ/Y5ZBf8HlBFsB6Xwm7rH75/9E="
crossorigin="anonymous"
>
{% endif %}
{% endif %}
6 changes: 5 additions & 1 deletion _includes/scripts/imageLayouts.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
<script src="https://cdn.jsdelivr.net/npm/img-comparison-slider@8.0/dist/index.min.js"></script>
{% endif %}
{% if page.images.slider %}
<script src="https://cdn.jsdelivr.net/npm/swiper@11.0.5/swiper-element-bundle.min.js" integrity="sha256-BPrwikijIybg9OQC5SYFFqhBjERYOn97tCureFgYH1E=" crossorigin="anonymous"></script>
<script
src="https://cdn.jsdelivr.net/npm/swiper@11.0.5/swiper-element-bundle.min.js"
integrity="sha256-BPrwikijIybg9OQC5SYFFqhBjERYOn97tCureFgYH1E="
crossorigin="anonymous"
></script>
{% endif %}
{% endif %}

0 comments on commit 1521333

Please sign in to comment.