Use these 7 Tips to increase the Speed of your Site
Published: 2020-04-26 19:55:25

<!-- wp:paragraph -->
<p>Page speed is important if you want to rank on google. I recently managed to do this:</p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center","id":706,"sizeSlug":"large"} -->
<div class="wp-block-image"><figure class="aligncenter size-large"><img src="https://wp.jdit.eu/wp-content/uploads/2020/04/image-42.png" alt="" class="wp-image-706"/></figure></div>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>In this article, I'll share how I managed to make my site fast and some of the things I noticed that slowed it down.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->
<h3>Bundling your Scripts to reduce their File Size</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>When scripts are sent across the web, they contain a lot of unnecessary bloat. Unlike humans, computers can read code even if its just a bunch of characters, so reducing any excess is going to help increase the speed of your page. There are many bundlers like webpack, which will automatically take your scripts and optimize the file size. Make sure you are using them!</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->
<h3>Use Purge CSS</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Purge CSS checks your entire code for unused selectors and removes them from your style sheet. </p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center"} -->
<div class="wp-block-image"><figure class="aligncenter"><img src="https://pbs.twimg.com/media/EWT49qcWsAAZ1X4?format=png&amp;name=small" alt="Image"/></figure></div>
<!-- /wp:image -->

<!-- wp:heading {"level":3} -->
<h3>Prefer regular Stylesheets over Styling with JavaScript</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>One of the biggest surprises for me was the fact that removing styled components, a framework that made it possible to use CSS in React, significantly increased the speed of my site. I was not aware that there was actually so much client-side JavaScript being executed by styled components, given that I assumed it was compiling to CSS on the server. The JavaScript execution time was reduced by 1.3 seconds, which could easily be the difference between a medium or good lighthouse score.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->
<h3>Reduce the Size of your Images</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Images are some of the biggest files that you send across the network. You want to have your images to be as low resolution as possible, without reducing the quality.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->
<h3>Avoid unnecessary Libraries</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Often, I would throw a library or package at a problem I was having. I really advise against this, because you end up having to undo a lot of the implementation once you want to increase the page of your site and these excess libraries are increasing the overhead.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->
<h3>Render the Website on the Server instead of the Browser</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>When you are using a single page framework, the content of the site is built from within the browser via JavaScript. There are services, however, that allow you to render these JavaScript based websites into HTML documents on the server and send them to the client. When you are rendering the content on the server, you gain multiple benefits: your website is easier to read for web crawlers like those from google and your users browser no longer has to do the heavy lifting of building the content. This is significant, because it means that the user can see and interact with content much faster, which is one of the most significant metrics that make up your page speed score ("Time to Interactive" and "First Contentful/Meaningful Paint"). Personally, I use Gatsby to render and process the content, but there many other good ones.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->
<h3>Avoid iFrame Embeddings if possible</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>It can be tempting to include a social media iFrame widget, but these are going to slow down your site considerably. Although you took care of adjusting the size of all your images to fit your website, Facebook and Twitter are not, so be ready to take a speed hit when you embed their content. </p>
<!-- /wp:paragraph -->