feat: improved image optimization

This commit is contained in:
Cory Dransfeldt 2024-02-01 10:53:34 -08:00
parent 9e118c83db
commit 0534bc5607
No known key found for this signature in database
10 changed files with 70 additions and 104 deletions

View file

@ -8,13 +8,13 @@ layout: default
{% endcapture %}
<style>{{ css }}</style>
{{ content }}
{% render "partials/now/media-grid.liquid", data:artists, icon: "microphone-2", title: "Artists", shape: "square", count: 8, loading: 'eager' %}
{% render "partials/now/media-grid.liquid", data:albums, icon: "vinyl", title: "Albums", shape: "square", count: 8 %}
{% render "partials/now/media-grid.liquid", data:artists, icon: "microphone-2", title: "Artists", shape: "square", count: 8, loading: 'eager', imageMaxWidth: 320 %}
{% render "partials/now/media-grid.liquid", data:albums, icon: "vinyl", title: "Albums", shape: "square", count: 8, imageMaxWidth: 320 %}
{% render "partials/now/albumReleases.liquid", albumReleases:albumReleases %}
{% render "partials/now/media-grid.liquid", data:books, icon: "books", title: "Books", shape: "vertical", count: 6 %}
{% render "partials/now/media-grid.liquid", data:books, icon: "books", title: "Books", shape: "vertical", count: 6, imageMaxWidth: 320 %}
{% render "partials/now/links.liquid", links:links %}
{% render "partials/now/media-grid.liquid", data:movies, icon: "movie", title: "Movies", shape: "vertical", count: 6 %}
{% render "partials/now/media-grid.liquid", data:tv, icon: "device-tv", title: "TV", shape: "vertical", count: 6 %}
{% render "partials/now/media-grid.liquid", data:movies, icon: "movie", title: "Movies", shape: "vertical", count: 6, imageMaxWidth: 320 %}
{% render "partials/now/media-grid.liquid", data:tv, icon: "device-tv", title: "TV", shape: "vertical", count: 6, imageMaxWidth: 320 %}
<p class="now__explainer text-center">
This is a <a href="https://nownownow.com/about">now page</a>, and if you have your own site, <a href="https://nownownow.com/about">you should make one too</a>.
</p>

View file

@ -37,7 +37,11 @@
'lazy'
{%- endif -%}
{%- endcapture -%}
{% image item.image, alt, 'item__image', loadingStrategy %}
{% if imageMaxWidth %}
{% image item.image, alt, '', loadingStrategy, imageMaxWidth %}
{% else %}
{% image item.image, alt, '', loadingStrategy %}
{% endif %}
</div>
</a>
{% endfor %}

View file

@ -403,17 +403,8 @@ li {
.image__banner {
border: 1px solid var(--accent-color);
border-radius: var(--rounded-lg);
overflow: hidden;
}
.image__banner,
.image__banner > * {
display: block;
width: 100%;
}
.image__banner > * {
height: auto;
width: 100%;
}
/* pages */

View file

@ -4,30 +4,18 @@
.avatar__wrapper {
width: 100%;
margin-bottom: 1.5rem;
justify-content: center;
}
.avatar__wrapper .avatar__wrapper--interior {
.avatar__wrapper img {
border-radius: var(--rounded-full);
border: 1px solid var(--accent-color);
width: var(--avatar-size);
height: var(--avatar-size);
border: 1px solid var(--accent-color);
border-radius: var(--rounded-full);
display: flex;
padding: 1rem;
background-color: var(--color-lightest);
}
.avatar__wrapper,
.avatar__wrapper .avatar__wrapper--interior {
justify-content: center;
overflow: hidden;
}
.avatar__wrapper .avatar__wrapper--interior > * {
width: 100%;
height: 100%;
}
@media screen and (min-width: 768px) {
:root {
--avatar-size: 24rem;

View file

@ -76,8 +76,7 @@
font-weight: 700;
}
.media__grid .item__image,
.media__grid .item__image > * {
.media__grid img {
width: 100%;
height: 100%;
}

View file

@ -9,10 +9,8 @@ image: /assets/img/ogi/about.jpg
{% endcapture %}
<style>{{ css }}</style>
<div class="avatar__wrapper flex--centered">
<div class="avatar__wrapper--interior">
{% capture about_alt %}{{ meta.siteName }} - image by David Neal / @reverentgeek{% endcapture %}
{% image './src/assets/img/avatar.webp', about_alt %}
</div>
{% capture about_alt %}{{ meta.siteName }} - image by David Neal / @reverentgeek{% endcapture %}
{% image './src/assets/img/avatar.webp', about_alt %}
</div>
<h2 class="page__header text-center">Hi, I'm Cory</h2>

View file

@ -14,9 +14,8 @@ tags: ['books', 'music', 'development', 'Eleventy']
<li><a href="https://www.last.fm/user/coryd_">I listened to a bunch of music</a></li>
<li><a href="https://trakt.tv/users/cdransf">I watched a bunch of movies and TV</a>, but picking favorites feels weird when so much of that consisted of catching up on "classics" and things I'd either ignored or never seen.</li>
</ul>
{% render "partials/now/media-grid.liquid", data:roundups['2023'].books, icon: "books", title: "Favorite books", shape: "vertical", count: 6, embeddedStyles: true %}
{% render "partials/now/media-grid.liquid", data:roundups['2023'].albums, icon: "vinyl", title: "Favorite albums", shape: "square", count: 8 %}
{% render "partials/now/media-grid.liquid", data:roundups['2023'].books, icon: "books", title: "Favorite books", shape: "vertical", count: 6, embeddedStyles: true, imageMaxWidth: 320 %}
{% render "partials/now/media-grid.liquid", data:roundups['2023'].albums, icon: "vinyl", title: "Favorite albums", shape: "square", count: 8, imageMaxWidth: 320 %}
<p><strong><a href="https://coryd.dev">I wrote some things:</a></strong></p>
<ul>