Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
cramforce committed Jan 27, 2021
1 parent 1f10c14 commit c422923
Showing 1 changed file with 0 additions and 10 deletions.
10 changes: 0 additions & 10 deletions _11ty/img-dim.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,19 +64,9 @@ const processImage = async (img, outputPath) => {
if (img.tagName == "IMG") {
img.setAttribute("decoding", "async");
img.setAttribute("loading", "lazy");
// Contain the intrinsic to the `--main-width` (width of the main article body)
// and the aspect ratio times that size. But because images are `max-width: 100%`
// use the `min` operator to set the actual dimensions of the image as the
// ceiling 🤯.
const containSize = `min(var(--main-width), ${
dimensions.width
}px) min(calc(var(--main-width) * ${
dimensions.height / dimensions.width
}), ${dimensions.height}px)`;
img.setAttribute(
"style",
`background-size:cover;` +
`contain-intrinsic-size: ${containSize};` +
`background-image:url("${await blurryPlaceholder(src)}")`
);
const doc = img.ownerDocument;
Expand Down

0 comments on commit c422923

Please sign in to comment.