<?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: 〄</title>
    <description>The latest articles on Forem by 〄 (@fleshmecha).</description>
    <link>https://forem.com/fleshmecha</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%2F361889%2Fbbfca31c-99f3-42fb-97fc-817352cf7c24.jpg</url>
      <title>Forem: 〄</title>
      <link>https://forem.com/fleshmecha</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/fleshmecha"/>
    <language>en</language>
    <item>
      <title>Why do you like Kotlin?</title>
      <dc:creator>〄</dc:creator>
      <pubDate>Fri, 17 Apr 2020 19:50:58 +0000</pubDate>
      <link>https://forem.com/fleshmecha/why-do-you-like-kotlin-54e4</link>
      <guid>https://forem.com/fleshmecha/why-do-you-like-kotlin-54e4</guid>
      <description>&lt;p&gt;I see many posts about Kotlin. What draws you to it?&lt;/p&gt;

</description>
      <category>kotlin</category>
      <category>discuss</category>
    </item>
    <item>
      <title>How do you decide between security and speed?</title>
      <dc:creator>〄</dc:creator>
      <pubDate>Fri, 10 Apr 2020 17:05:21 +0000</pubDate>
      <link>https://forem.com/fleshmecha/how-do-you-decide-between-security-and-speed-2248</link>
      <guid>https://forem.com/fleshmecha/how-do-you-decide-between-security-and-speed-2248</guid>
      <description>&lt;h3&gt;
  
  
  This is a question for people who have enabled a &lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP"&gt;Content Security Policy&lt;/a&gt; header on their website.
&lt;/h3&gt;

&lt;p&gt;Using Content Security Policy headers requires you to &lt;em&gt;remove all inline CSS and Javascript&lt;/em&gt;, which is why I have not done it.&lt;/p&gt;

&lt;p&gt;Inline CSS and Javascript is &lt;a href="https://www.awwwards.com/brainfood-mobile-performance-vol3.pdf"&gt;critical&lt;/a&gt; for speed. How do you balance this? &lt;/p&gt;

&lt;p&gt;This is a huge dilemma for me, because &lt;strong&gt;reducing HTTP requests by inlining CSS/JS makes the site faster.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;However, I've read so many articles saying that a Content Security Policy is your number one defense against cross site scripting &lt;a href="https://developer.mozilla.org/en-US/docs/Glossary/Cross-site_scripting"&gt;(XSS)&lt;/a&gt; attacks. &lt;/p&gt;

&lt;p&gt;What to do?&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>webperf</category>
      <category>security</category>
      <category>discuss</category>
    </item>
    <item>
      <title>I Created A New Way To Make Your Site Faster</title>
      <dc:creator>〄</dc:creator>
      <pubDate>Thu, 09 Apr 2020 00:16:50 +0000</pubDate>
      <link>https://forem.com/fleshmecha/a-new-way-to-make-your-site-faster-4h81</link>
      <guid>https://forem.com/fleshmecha/a-new-way-to-make-your-site-faster-4h81</guid>
      <description>&lt;h2&gt;
  
  
  I love a fast website. But it's hard to achieve.
&lt;/h2&gt;

&lt;p&gt;You can make your site faster when you preload the next page the user will navigate to and render it in the background. &lt;/p&gt;

&lt;p&gt;The current libraries that do this do not support older browsers.&lt;/p&gt;

&lt;h2&gt;
  
  
  Every user deserves blazing fast load times.
&lt;/h2&gt;

&lt;p&gt;This is why I made &lt;strong&gt;prerender.js&lt;/strong&gt;, which loads pages before a user clicks on them. &lt;/p&gt;

&lt;h3&gt;
  
  
  How is this different from current solutions?
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;prerender.js&lt;/strong&gt; is designed to work on a mobile phone from 2020 or a PC running Internet Explorer 8. It is designed to be universal. &lt;/p&gt;

&lt;h3&gt;
  
  
  Isn't prerender expensive for bandwidth? You can't just prerender every link!
&lt;/h3&gt;

&lt;p&gt;Prerender is expensive for bandwidth, so I  made prerendering occur on touchstart or mouseover.&lt;/p&gt;

&lt;h3&gt;
  
  
  Can I make links prerender that are loaded from button clicks?
&lt;/h3&gt;

&lt;p&gt;Here's how to use &lt;strong&gt;prerender.js&lt;/strong&gt; with button hovers:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function buttonRender() {
  var x = document.createElement("link");
  x.setAttribute("rel", "prerender");
  x.setAttribute("href", location.href); //location.href = "/example.html"
  document.head.appendChild(x);
}
document.getElementById("mybutton").onmouseover = function() {buttonRender()};
document.getElementById("mybutton").ontouchstart = function() {buttonRender()};
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  Can I be part of this?
&lt;/h3&gt;

&lt;p&gt;If you want to make the functionality for buttons nicer and neater, make a pull request to the &lt;a href="https://github.com/genderev/prerender.js"&gt;Github repo&lt;/a&gt;. &lt;strong&gt;Please.&lt;/strong&gt; I'm asking nicely.&lt;/p&gt;

</description>
      <category>webperf</category>
      <category>showdev</category>
      <category>javascript</category>
      <category>news</category>
    </item>
    <item>
      <title>Stop Bundling Scripts for Better Web Performance</title>
      <dc:creator>〄</dc:creator>
      <pubDate>Mon, 06 Apr 2020 17:15:35 +0000</pubDate>
      <link>https://forem.com/fleshmecha/stop-bundling-scripts-for-better-web-performance-4e4n</link>
      <guid>https://forem.com/fleshmecha/stop-bundling-scripts-for-better-web-performance-4e4n</guid>
      <description>&lt;h3&gt;
  
  
  Here's the conventional advice:
&lt;/h3&gt;

&lt;h1&gt;
  
  
  for a fast webpage, split your code and bundle it.
&lt;/h1&gt;

&lt;p&gt;This advice did not work for me. &lt;/p&gt;

&lt;p&gt;Whenever I split my code into manageable subsets, the page broke. I still bundled my code to reduce HTTP requests &lt;a href="https://docs.netlify.com/site-deploys/post-processing/#post-processing-features"&gt;(using Netlify's post processing)&lt;/a&gt;, and my page loaded in over 2 seconds, with 1.5 seconds being dedicated to the huge bundled script. Not acceptable. Shouldn't reducing HTTP requests lead to a faster page? This is web performance gospel - &lt;a href="https://dev.to/ben/addy-osmanis-18-point-web-performance-checklist-2e1"&gt;reduce HTTP requests!&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Kdtpvpv8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/x4aag1cwof68yqj7hijy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Kdtpvpv8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/x4aag1cwof68yqj7hijy.png" alt="My page speed while bundling scripts"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I did have a service worker that was caching static assets for me, but the caching only increased page speed because those static assets were never used in the cached form. &lt;/p&gt;

&lt;p&gt;The service worker would cache sea.js, but since sea.js was bundled with webrtc.js and jquery.min.js in production, that cached asset never saw the light of day.&lt;/p&gt;

&lt;p&gt;I think you can see where I'm going with this. &lt;strong&gt;Unbundle!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3aptYkqe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/a2sr1aggsm8lbqft3xvu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3aptYkqe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/a2sr1aggsm8lbqft3xvu.png" alt="Page speed while unbundling scripts"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After unbundling the scripts, all of them loaded asynchronously in under 50 &lt;em&gt;ms&lt;/em&gt;. &lt;/p&gt;

&lt;h2&gt;
  
  
  From 1.5 seconds of loading to &lt;em&gt;50 ms&lt;/em&gt; loading.
&lt;/h2&gt;

&lt;p&gt;The whole page loaded in &lt;strong&gt;77ms.&lt;/strong&gt; Wow.&lt;/p&gt;

&lt;p&gt;This speed increase from unclicking one button on Netlify's post-processing options was too incredible for me not to share. &lt;/p&gt;

&lt;p&gt;Of course, this post assumes you are using a service worker to pre-cache static assets. If you're not, you can read the documentation to &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API/Using_Service_Workers"&gt;learn why service workers are useful&lt;/a&gt; and &lt;a href="https://serviceworke.rs/"&gt;follow some tutorials&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I have Lighthouse, YSlow, and PageSpeed scores of 100 across the board, largely because of service workers.&lt;/p&gt;

&lt;h3&gt;
  
  
  This is my first DEV post. Let me know what you think!
&lt;/h3&gt;

</description>
      <category>webperf</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>serviceworkers</category>
    </item>
  </channel>
</rss>
