<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Fabian</title>
    <description>The latest articles on Forem by Fabian (@fabkrut).</description>
    <link>https://forem.com/fabkrut</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F418698%2F37bafa7b-ac32-4ebf-9f7c-2d967b8e37e0.jpg</url>
      <title>Forem: Fabian</title>
      <link>https://forem.com/fabkrut</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/fabkrut"/>
    <language>en</language>
    <item>
      <title>Developing for Safari on Windows 10 / Linux</title>
      <dc:creator>Fabian</dc:creator>
      <pubDate>Sat, 23 Jan 2021 15:05:36 +0000</pubDate>
      <link>https://forem.com/fabkrut/developing-for-safari-on-windows-10-linux-2an</link>
      <guid>https://forem.com/fabkrut/developing-for-safari-on-windows-10-linux-2an</guid>
      <description>&lt;p&gt;&lt;strong&gt;Are you a Web Developer?&lt;/strong&gt;&lt;br&gt;
If yes, my bet is that you are probably developing on one of the following browsers: Chrome, Opera, Firefox, Edge, Brave or Safari.&lt;/p&gt;

&lt;p&gt;In the end, it boils down to the big three browsers: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Chromium based&lt;/li&gt;
&lt;li&gt;Safari&lt;/li&gt;
&lt;li&gt;Firefox&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Even though I am &lt;strong&gt;currently&lt;/strong&gt; a kind of happy Firefox user, the market share of the browser is converging to zero and ultimately it seems like the browser is dying. They even decided to close the ticket regarding the &lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1407202" rel="noopener noreferrer"&gt;install option for PWA&lt;/a&gt; without plans of continuing.&lt;/p&gt;

&lt;p&gt;Beside the nagging, a lot of consumers are effectively using Safari on desktop and especially mobile. &lt;em&gt;(cf. &lt;a href="https://gs.statcounter.com/browser-market-share" rel="noopener noreferrer"&gt;statcounter&lt;/a&gt; or &lt;a href="https://caniuse.com/flexbox" rel="noopener noreferrer"&gt;Can I Use&lt;/a&gt;)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;So, how do we as Web Developer test on Safari, without feeling uncomfortable? In the past I had jobs where I could make use of a local MacBook or paid services like browserstack. It felt burdensome for me to work on a macOS, mostly because I was not used to it and my peripherals were somewhere else. And even if you would have a macOS at your workplace, given the fact that most of us are working from home right now, this is no longer an option.&lt;/p&gt;

&lt;h1&gt;🤝 The solution &lt;/h1&gt;

&lt;p&gt;Have you heard of &lt;a href="https://github.com/microsoft/playwright" rel="noopener noreferrer"&gt;Playwright?&lt;/a&gt; &lt;br&gt;
&lt;u&gt;If your answer is no, &lt;/u&gt; then let me tell you that Playwright is a Node.js library to automate Chromium, Firefox and WebKit with a single API. In fact, the API is very simular to Puppeteer, because two of the Developers moved from Puppeteer to Playwright. &lt;em&gt;(cf. &lt;a href="https://github.com/puppeteer/puppeteer/graphs/contributors" rel="noopener noreferrer"&gt;Puppeteer Contributions&lt;/a&gt; vs. &lt;a href="https://github.com/microsoft/playwright/graphs/contributors" rel="noopener noreferrer"&gt;Playwright Contributions&lt;/a&gt;)&lt;/em&gt;&lt;br&gt;
&lt;u&gt;If your answer is yes, &lt;/u&gt; and if you are not using Safari yet for testing purposes as Windows or Linux user, then congratulations, you are just like me 🤡.&lt;/p&gt;

&lt;p&gt;The solution was right in front of us and I am happy to share a little snippet to kickstart the browser, so that we all can create better applications 🚀&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// unflagged top-level await from Node 14.8.0+&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;webkit&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;playwright&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;browser&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;webkit&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;launch&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;headless&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;context&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;browser&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;newContext&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;page&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;context&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;newPage&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;page&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;goto&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;https://www.whatismybrowser.com/&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For anything else, please refer to the official playwright documentation.&lt;/p&gt;

&lt;h2&gt;🖼 Further improvements on Windows &lt;/h2&gt;

&lt;p&gt;If you do not want to execute the .js file everytime you want to make use of Safari, follow these steps: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Execute the script&lt;/li&gt;
&lt;li&gt;Open the Task Manager, go to tab 'Details', right-click on Playwright.exe and select 'Open file location'.&lt;/li&gt;
&lt;li&gt;Right-click on Playwright.exe in the folder and click on 'Create shortcut'&lt;/li&gt;
&lt;li&gt;(optional) download Safari Icon from &lt;a href="https://en.wikipedia.org/wiki/Safari_(web_browser)#/media/File:Safari_14_icon.png" rel="noopener noreferrer"&gt;wikipedia&lt;/a&gt;, convert it to an icon, save it in the folder, right-click on the shortcut, properties 'Change Icon' and select the .ico.&lt;/li&gt;
&lt;li&gt;Right-click the shortcut and select 'Pin to Start'&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fxyn0dn4traas4mnaifk5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fxyn0dn4traas4mnaifk5.png" alt="Start Safari" width="147" height="178"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>testing</category>
      <category>safari</category>
      <category>webdev</category>
      <category>programming</category>
    </item>
    <item>
      <title>Enhancing Images on the Web</title>
      <dc:creator>Fabian</dc:creator>
      <pubDate>Tue, 30 Jun 2020 21:23:20 +0000</pubDate>
      <link>https://forem.com/fabkrut/enhancing-images-on-the-web-3b35</link>
      <guid>https://forem.com/fabkrut/enhancing-images-on-the-web-3b35</guid>
      <description>&lt;p&gt;As a developer, I noticed that I sometimes code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;img&lt;/span&gt; &lt;span class="err"&gt;...&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;However, there are some points to consider when working with images:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Lazy Loading&lt;/li&gt;
&lt;li&gt;Responsiveness&lt;/li&gt;
&lt;li&gt;Avoiding Layout Shifts&lt;/li&gt;
&lt;li&gt;File Size&lt;/li&gt;
&lt;li&gt;Intial fast load&lt;/li&gt;
&lt;li&gt;Accessibility&lt;/li&gt;
&lt;li&gt;Art Direction&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Which leads to the question — is there a way to combine as many points of them as possible with one approach? &lt;strong&gt;Luckily there is&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;The importance of images&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;First, let’s emphasize why we should care about this. On &lt;a href="https://httparchive.org/reports/page-weight?view=grid" rel="noopener noreferrer"&gt;HTTP Archive&lt;/a&gt; it is noticable that 47.3% of the total sent KB per page are from images on desktop in 2020 (47.9% on mobile).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fsc6rm24g2o51zx5ubwqp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fsc6rm24g2o51zx5ubwqp.png" alt="Page Weight on HTTP Archive" width="323" height="475"&gt;&lt;/a&gt;&lt;/p&gt;
Page Weight on HTTP Archive



&lt;p&gt;Because the summed bytes do not equal the &lt;em&gt;Total Kilobytes&lt;/em&gt;, I created the following chart.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fla4hp4oo5hd0maleuf0w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fla4hp4oo5hd0maleuf0w.png" alt="Images: 31.5% for Desktop | 32.5% for Mobile" width="800" height="333"&gt;&lt;/a&gt;&lt;/p&gt;
Images: 31.5% for Desktop | 32.5% for Mobile



&lt;p&gt;Altough videos are the most significant ressources considering the size, images are on the next place and from a developers perspective, almost all applications are using images which is not true for videos.&lt;br&gt;
&lt;br&gt;&lt;br&gt;
Another reason for improving images is to make yourself and other people happy browsing on the web. The internet connection might be weak or the mobile data plan might be throttled. Both causes lead to long waiting times, which are definitely unwanted😔.&lt;/p&gt;
&lt;h2&gt;
  
  
  &lt;strong&gt;The approach&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Native lazy loading is supported in all modern browsers beside Safari (support is in the &lt;em&gt;Experimental Phase&lt;/em&gt;). It can be added via an attribute on the element.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;img&lt;/span&gt; &lt;span class="na"&gt;loading=&lt;/span&gt;&lt;span class="s"&gt;”lazy"&lt;/span&gt; &lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"..."&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fgcdm37tuyyci0n7l6ahx.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fgcdm37tuyyci0n7l6ahx.PNG" alt="https://caniuse.com/#feat=loading-lazy-attr" width="642" height="226"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;a href="https://caniuse.com/#feat=loading-lazy-attr" rel="noopener noreferrer"&gt;https://caniuse.com/#feat=loading-lazy-attr&lt;/a&gt;



&lt;p&gt;Alternatively it is possible to use a library which polyfills this functionality. Beside lazy loading to reduce the initial payload, the images could be optimized. However, this is something off the web which would contain reducing quality, reducing the dimensions width and height and transforming the image to better types such as &lt;em&gt;webp&lt;/em&gt; or &lt;em&gt;AVIF&lt;/em&gt;™(flagged support in Firefox).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fzer8e3x6en54h1bwc6wo.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fzer8e3x6en54h1bwc6wo.PNG" alt="webp support https://caniuse.com/#search=webp" width="642" height="244"&gt;&lt;/a&gt;&lt;/p&gt;
webp support &lt;a href="https://caniuse.com/#search=webp" rel="noopener noreferrer"&gt;https://caniuse.com/#search=webp&lt;/a&gt;



&lt;p&gt;&lt;strong&gt;Progressive Image Loading&lt;/strong&gt; — a way to display a low quality preview image and loading the high quality picture at the same time, would also be a great way to save bytes for the intital load (like on medium). While there are libraries for this, I tried to do this without altering the HTML and display the image simultaneously to the request via &lt;em&gt;Streams&lt;/em&gt;. &lt;a href="https://fetch-progress.anthum.com/sw-basic/" rel="noopener noreferrer"&gt;Example of fetch progress here&lt;/a&gt;. Sadly, this did not work. Even though the browser was able to display an halfway received image, the transformed Uint8Array could not resolve to an image. Here is the used code to transform the array:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;createImageFromArrayBuffer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;type&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;arrayBuffer&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
 &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;base64String&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; 
   &lt;span class="nf"&gt;btoa&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;String&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fromCharCode&lt;/span&gt;&lt;span class="p"&gt;(...&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt;  &lt;span class="nc"&gt;Uint8Array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;arrayBuffer&lt;/span&gt;&lt;span class="p"&gt;)));&lt;/span&gt;
 &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;image&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Image&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
 &lt;span class="nx"&gt;image&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;src&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`data:&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;type&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;base64,&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;base64String&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
 &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;image&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;body&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;createImage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;image/jpeg&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;arrayBuffer&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We will come back to Progressive Image Loading at a later state.&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;p&gt;So how is it possible to fix responsive layout and &lt;a href="https://twitter.com/addyosmani/status/1276779799198007301" rel="noopener noreferrer"&gt;layout shifts&lt;/a&gt; at the same time? Both approaches require information about width and height — in HTML and CSS. While setting it in HTML seems like an old fashioned way, it is actually helpful for the browser since December 2019 (Chrome and Firefox). And it will stay responsive as long as the CSS remains. Awesome🎉&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;p&gt;Now, only accessibility, art direction and intial fast load remain open. From my perspective, there is not much to do for accessibility beside adding an alt attribute to the &lt;em&gt;&amp;lt;img&amp;gt;&lt;/em&gt;.&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Art Direction&lt;/strong&gt; — means that an image might be cropped, exchanged etc. depending on device size, device resolution, dpi, orientation and more. This is easily achievable with the &lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/picture" rel="noopener noreferrer"&gt;&amp;lt;picture&amp;gt;&lt;/a&gt; element via the media attribute and &lt;em&gt;&lt;/em&gt; subelements. Those subelements can also be used to let the browser choose the best image type and to change to a higher resolution picture, when needed. (This works with lazy load🤯)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;// type
&lt;span class="nt"&gt;&amp;lt;picture&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;source&lt;/span&gt; &lt;span class="na"&gt;srcset=&lt;/span&gt;&lt;span class="s"&gt;"logo2x.webp"&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"image/webp"&lt;/span&gt; &lt;span class="na"&gt;media=&lt;/span&gt;&lt;span class="s"&gt;"(min-width:
    601px)"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;source&lt;/span&gt; &lt;span class="na"&gt;srcset=&lt;/span&gt;&lt;span class="s"&gt;"logo1x.webp"&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"image/webp"&lt;/span&gt; &lt;span class="na"&gt;media=&lt;/span&gt;&lt;span class="s"&gt;"(max-width:
    600px)"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;img&lt;/span&gt; &lt;span class="na"&gt;loading=&lt;/span&gt;&lt;span class="s"&gt;"lazy"&lt;/span&gt; &lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"logo.jpg"&lt;/span&gt; &lt;span class="na"&gt;alt=&lt;/span&gt;&lt;span class="s"&gt;"logo"&lt;/span&gt; &lt;span class="na"&gt;height=&lt;/span&gt;&lt;span class="s"&gt;"320"&lt;/span&gt; 
    &lt;span class="na"&gt;width=&lt;/span&gt;&lt;span class="s"&gt;"320"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/picture&amp;gt;&lt;/span&gt;// srcset
&lt;span class="nt"&gt;&amp;lt;picture&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;source&lt;/span&gt; &lt;span class="na"&gt;srcset=&lt;/span&gt;&lt;span class="s"&gt;"logo-768.png 768w, logo-768-1.5x.png 1.5x"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;source&lt;/span&gt; &lt;span class="na"&gt;srcset=&lt;/span&gt;&lt;span class="s"&gt;"logo-480.png, logo-480-2x.png 2x"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;img&lt;/span&gt; &lt;span class="na"&gt;loading=&lt;/span&gt;&lt;span class="s"&gt;"lazy"&lt;/span&gt; &lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"logo-320.png"&lt;/span&gt; &lt;span class="na"&gt;alt=&lt;/span&gt;&lt;span class="s"&gt;"logo"&lt;/span&gt; &lt;span class="na"&gt;height=&lt;/span&gt;&lt;span class="s"&gt;"320"&lt;/span&gt; 
    &lt;span class="na"&gt;width=&lt;/span&gt;&lt;span class="s"&gt;"320"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/picture&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Which combines almost all of our best practices. That is where progressive loading for the intial fast load comes in. Because it is not natively supported, &lt;a href="https://github.com/Krutsch/progressive-picture" rel="noopener noreferrer"&gt;I created a library&lt;/a&gt;. All there is to do is adding data-src attributes for the high quality picture and putting the URI of the low quality picture in the srcset and src. It will even change the to the next picture’s width and height attributes, however, it would be probably preferable if these stay the same.&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://lazy-load-picture.netlify.app/masonry.html" rel="noopener noreferrer"&gt;This is where you can find a masonry demo.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;br&gt;&lt;br&gt;
&lt;br&gt;&lt;br&gt;
Is this the &lt;em&gt;silver bullet&lt;/em&gt;? Leave your comment 🤗&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>css</category>
      <category>html</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
