<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/"
    xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" version="2.0">
    <channel>
        
        <title>
            <![CDATA[ Website performance - freeCodeCamp.org ]]>
        </title>
        <description>
            <![CDATA[ Browse thousands of programming tutorials written by experts. Learn Web Development, Data Science, DevOps, Security, and get developer career advice. ]]>
        </description>
        <link>https://www.freecodecamp.org/news/</link>
        <image>
            <url>https://cdn.freecodecamp.org/universal/favicons/favicon.png</url>
            <title>
                <![CDATA[ Website performance - freeCodeCamp.org ]]>
            </title>
            <link>https://www.freecodecamp.org/news/</link>
        </image>
        <generator>Eleventy</generator>
        <lastBuildDate>Tue, 25 Aug 2026 04:22:11 +0000</lastBuildDate>
        <atom:link href="https://www.freecodecamp.org/news/tag/website-performance/rss.xml" rel="self" type="application/rss+xml" />
        <ttl>60</ttl>
        
            <item>
                <title>
                    <![CDATA[ A Developer's Guide to Website Speed Optimization ]]>
                </title>
                <description>
                    <![CDATA[ By Digvijay Singh I think a lot about how we can optimize our websites for speed. The world is getting busy and nobody likes to wait for a website to load. There are very few things a user can do to make a website go faster. But for developers like ]]>
                </description>
                <link>https://www.freecodecamp.org/news/developers-guide-to-website-speed-optimization/</link>
                <guid isPermaLink="false">66d45e3c51f567b42d9f8454</guid>
                
                    <category>
                        <![CDATA[ optimization ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Website performance ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Tue, 12 May 2020 16:07:06 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2020/05/Developers-Guide-To-optimize-website.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Digvijay Singh</p>
<p>I think a lot about how we can optimize our websites for speed. The world is getting busy and nobody likes to wait for a website to load.</p>
<p>There are very few things a user can do to make a website go faster. But for developers like us, the possibilities are endless. The real optimization starts with the code and finishes on server side things like hosting, CDN's, caching and much more.</p>
<p>Here I have collected the best possible ways to optimize a website which I learned and implemented while creating a theme for my blog on Ghost CMS.</p>
<p>Here is a picture of the results.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/05/ghost-new-theme-speed-demo.png" alt="Image" width="600" height="400" loading="lazy">
<em>Custom theme demo</em></p>
<p>The theme is so fast because it contains no extra functionality other than what I need on a very minimal blog. I pay $5/month for cloud hosting. For now I've hidden the domain because its hosted temporarily (testing with some new things).</p>
<h2 id="heading-why-speed-matters">Why Speed Matters</h2>
<p>People are busy and they will not waste their precious time waiting for your website to load.</p>
<p>Website loading speed has been one of the most important factors in SEO since <a target="_blank" href="https://webmasters.googleblog.com/2010/04/using-site-speed-in-web-search-ranking.html">April 2010</a>. Users love fast websites where they can get useful information.</p>
<p>One more exciting thing about loading speed is that it affects your brand image. I can easily recall 3-4 superfast websites which load right after the click.</p>
<p>Suppose you are visiting a product site and it takes 10 seconds to load. Will you waste another 10 seconds in the billing page? How would this affect your trust? Will you trust a website which takes so much time to load?</p>
<blockquote>
<p>Think like a user before you act as a Developer.</p>
</blockquote>
<p>Good websites load faster and users get the webpage in a flash.</p>
<h2 id="heading-different-speed-testing-tools">Different Speed Testing Tools</h2>
<p>Now you know why we need to optimize our websites to load faster. Here is a quick overview of the tools which are popular in benchmarking performance.</p>
<h3 id="heading-your-own-browser">Your own browser</h3>
<p>Yes, your browser has a powerful tool to let you know the loading speed of your website. I generally use it to get detailed information on the number of files (scripts and stylesheets) that load on each webpage request.</p>
<p>Open the developer’s tools of your browser (right-click then inspect) and then go to the networks tab. Reload the webpage with cache disabled and you will see the detailed statistics of loading speed.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/05/chrome-network-tools.png" alt="Image" width="600" height="400" loading="lazy">
<em>Chrome network tools</em></p>
<p>But this method is limited because it tests the loading speed from your location only. And we know that speed changes at different points around the globe.</p>
<h3 id="heading-pingdom-toolshttpstoolspingdomcom"><a target="_blank" href="https://tools.pingdom.com/">Pingdom tools</a></h3>
<p>Here is the solution for global speed testing: choose multiple locations from where to test your website loading speed.</p>
<p>It also provides a detailed report with recommendations you can use to further optimize.</p>
<h3 id="heading-page-speed-insightshttpsdevelopersgooglecomspeedpagespeedinsights-based-on-lighthouse"><a target="_blank" href="https://developers.google.com/speed/pagespeed/insights/">Page Speed Insights</a> (Based on lighthouse)</h3>
<p>Page Speed Insights created the belief that a score of 100 is must for SEO.</p>
<p>This is not completely true, though, because some of the most popular websites have a score less than 70.</p>
<p>Page speed insights use Lighthouse as their analysis tool and it's not directly related to SEO.</p>
<p>Lighthouse is an open-source website performance analysis tool. It audits the website for performance, SEO, accessibility, progressive web apps and much more.</p>
<p>Lighthouse is also available as a browser extension or <a target="_blank" href="https://www.npmjs.com/package/lighthouse">NPM package</a> if you are developing a website locally.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/05/lighthouse-screenshot.png" alt="Image" width="600" height="400" loading="lazy">
<em>Lighthouse website analysis report</em></p>
<p>It gives some important optimizing details which other tools fail to report. It is very helpful to reduce the webpage size and optimize the loading speed of the website.</p>
<h3 id="heading-gtmetrixhttpsgtmetrixcom"><a target="_blank" href="https://gtmetrix.com/">GTmetrix</a></h3>
<p>I find this much more accurate than other services. It gives accurate insights about the loading speed of your website. It also gives an in-depth report of the best practices which can further improve the performance of your website.</p>
<h2 id="heading-the-best-ways-to-optimize-website-loading-speed">The Best Ways to Optimize Website Loading Speed</h2>
<p>Here comes the part where we'll start working on optimization. All these steps are very helpful in improving the performance of any website. </p>
<p>But just remember that not all steps are necessary for everyone. You can skip the steps which might break your site (happens a lot during optimization).</p>
<h3 id="heading-avoid-additional-packages-and-scripts-wherever-possible">Avoid additional packages and scripts wherever possible</h3>
<p>When I started web development, I preferred NPM install for each and every problem. But I was a noob :). Very soon I realised the cost of installing a new package for every problem I faced.</p>
<p>Using npm packages is good for rapid development but every new package comes with many additional functionalities which you might never need. </p>
<p>The real problem lies in updating the project. Packages deprecate with time so managing a lot of packages is like a nightmare.</p>
<p>It's a good idea to try to solve basic problems by yourself instead of finding an NPM package to do it for you.</p>
<p>Here is a useful <a target="_blank" href="https://marketplace.visualstudio.com/items?itemName=wix.vscode-import-cost">VS Code extension</a> that lets you know the size of the imported package.</p>
<p>The same thing applies to jQuery. There was a time when it was a must-have JavaScript library for each and every application. But now Vanilla JS stands strong.</p>
<p>If you can avoid using jQuery, it will save you about 30KB of additional loading to your webpage.</p>
<p>This website is helpful for finding jQuery alternatives: <a target="_blank" href="http://youmightnotneedjquery.com/">Amazing collection of jQuery alternatives.</a></p>
<p>I saved around 100ms only by removing jQuery from my Ghost CMS theme. It was a lot to work to replace jQuery with Vanilla Js but the result was awesome.</p>
<p>And it is good to say every script counts in performance.</p>
<h3 id="heading-remove-unused-css">Remove unused CSS</h3>
<p>CSS frameworks are very helpful in the rapid development of web applications. However, they have many components and styles which we never use in our projects.</p>
<p><a target="_blank" href="https://purgecss.com/">PurgeCSS</a> is very helpful in this case, as it removes the unused CSS from the stylesheet.</p>
<p>It is not as easy to use as it seems but it's worth the time investment. </p>
<p>Just a heads up: sometimes PurgeCSS also removes the CSS which is useful to your projects. So I recommend that you manually verify and test the website properly after using it.</p>
<p>As an example, the dark theme of my website was broken because PurgeCSS removed the CSS variables as they were unused at that time.</p>
<h3 id="heading-minify-css-and-javascript">Minify CSS and JavaScript</h3>
<p>You should minify Javascript and CSS files before pushing them to the production server.</p>
<p>Minify CSS and Javascript mean removing unnecessary code like comments, space, tabs from the file, because in production they are only for browsers to understand.</p>
<p>This reduces approximately 50% of the file size and enables your web pages to load much faster.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/05/Minified-javascript-advantage.png" alt="Image" width="600" height="400" loading="lazy">
<em>Minfied Javascript size reduced by 47%</em></p>
<p>Here are online CSS and Javascript minifiers which you can use.</p>
<ul>
<li><a target="_blank" href="https://cssminifier.com/">Online CSS Minifier</a></li>
<li><a target="_blank" href="https://javascript-minifier.com/">Online JavaScript Minifier</a></li>
</ul>
<p>This is aother observation using Tailwind CSS with minify and purge CSS:</p>
<ul>
<li>Original size of stylesheet: ~150KB</li>
<li>With Minify+Purge CSS: 4.9KB (and everything was working fine)</li>
</ul>
<p>It was not a one-shot solution, though. Initially it broke many things (like night mode and many other functionalities triggered by Javascript) because purge CSS removed it as they were unused at that time.</p>
<p>I had to manually review and exclude those styles from the purge CSS plugin.</p>
<h3 id="heading-compress-and-resize-images">Compress and resize images</h3>
<p>Images are critical factors that affect the loading speed of any website. A lot of websites use high-resolution images even when they don't need it.</p>
<p>The perfect example is that you don't need a 2000 x 2000 image for a 250 x 250 author image.</p>
<p>Always consider cropping and compressing your images before you upload them to the web.</p>
<p>You can use online compression tools like <a target="_blank" href="https://tinypng.com/">Tiny PNG</a> to compress images before using them on your website. You can reduce up to 60-70% of image size using image compression.</p>
<h3 id="heading-lazy-loading-images">Lazy loading images</h3>
<p>As I said, images are critical factors in website loading speed. This means you must take the right steps toward optimizing images when loading them.</p>
<p>First, you can defer offscreen images. This means that the images after 1 viewport height will load once the user scrolls to them.</p>
<p>Lazy loading is also recommended and is very efficient in optimizing your website for fast loading.</p>
<p>It's helpful because sometimes the user doesn't need to scroll all the way to the bottom of the page and read all contents of your website. So lazy loading only loads images when the user scrolls to them.</p>
<p>You must implement lazy loading carefully and make sure JavaScript fallbacks are in place as an alternative.</p>
<p>You can take the example of Medium.com's articles for lazy loading of images. They put an image of very low resolution as a placeholder and load the original image once the user scrolls to it.</p>
<p></p><p>
  <span>See the Pen <a href="https://codepen.io/malchata/pen/mXoZGx">
  Lazy Loading Example</a> by Jeremy Wagner (<a href="https://codepen.io/malchata">@malchata</a>)
  on <a href="https://codepen.io">CodePen</a>.</span>
</p><p></p>


<h3 id="heading-defer-javascript-loading">Defer JavaScript loading</h3>
<p>You should always put all heavy scripts at the end of the page before the closing body tag.</p>
<pre><code class="lang-html"><span class="hljs-meta">&lt;!DOCTYPE <span class="hljs-meta-keyword">html</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">html</span> <span class="hljs-attr">lang</span>=<span class="hljs-string">"en"</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">head</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">meta</span> <span class="hljs-attr">charset</span>=<span class="hljs-string">"UTF-8"</span> /&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">meta</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"viewport"</span> <span class="hljs-attr">content</span>=<span class="hljs-string">"width=device-width, initial-scale=1.0"</span> /&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">title</span>&gt;</span>Script Demo<span class="hljs-tag">&lt;/<span class="hljs-name">title</span>&gt;</span>
  <span class="hljs-tag">&lt;/<span class="hljs-name">head</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">body</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">header</span>&gt;</span>Some Beautiful Header that Rocks<span class="hljs-tag">&lt;/<span class="hljs-name">header</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">article</span>&gt;</span> Some awesome Content ... <span class="hljs-tag">&lt;/<span class="hljs-name">article</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">section</span>&gt;</span>Some more content...<span class="hljs-tag">&lt;/<span class="hljs-name">section</span>&gt;</span>


    <span class="hljs-comment">&lt;!-- This is Where all the heavy scripts and stylesheets should be present. --&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">script</span> <span class="hljs-attr">src</span>=<span class="hljs-string">"js/scripts.js"</span> <span class="hljs-attr">defer</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span>

  <span class="hljs-tag">&lt;/<span class="hljs-name">body</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">html</span>&gt;</span>
</code></pre>
<p>This is important because users can at least read the contents on slower connections while heavy scripts keep loading in the background.</p>
<p>This is one of the most common problems highlighted by Google speed insights. You can easily improve your score by implementing this step properly.</p>
<p>The defer attribute is helpful in this scenario, as it allows script execution only after the document is loaded.</p>
<h3 id="heading-select-a-good-hosting-provider">Select a good hosting provider</h3>
<p>You can never expect good website loading speed on shared hosting of any low-quality hosting provider.</p>
<p>Go for VPS if you can afford it, or cloud hosting (they are as cheap as 5$ a month at Linode, Digital Ocean, and Vultr, for example).</p>
<p>Low quality hosting providers won't affect your website's speed much if you don't have many visitors. However, as the number of visitors grows they fail to handle such traffic.</p>
<p>That's why it is good to remain on the safe side and keep your website running on traffic spikes.</p>
<h3 id="heading-use-a-cdn">Use a CDN</h3>
<p>If your website has visitors from all around the globe, then CDNs will help deliver your assets quickly.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/05/CDN-vs-without-CDN.png" alt="Image" width="600" height="400" loading="lazy">
<em>With CDN vs without CDN</em></p>
<p>The users gets the assets from the nearest CDN node ensuring the shortest travel for data. This reduces the overall loading speed of the website and provides a consistent experience for all your users.</p>
<h3 id="heading-caching">Caching</h3>
<p>Caching is the best possible solution for the fastest website loading speed. Cache as much as possible, but with care.</p>
<p>Caching on the server-side enables faster delivery of data and on the client-side empowers lightning-fast loading speed.</p>
<p>There are various resources like scripts, stylesheets, and some other common files which are used with every page load. We can cache them locally so next time they are fetched from the cache instead of the server.</p>
<p>Server-side caching prevents excess database operations each time and saves both time and money.</p>
<p>Just keep in mind that server-side caching is not suitable if you have too much dynamic data.</p>
<p>You must be careful with caching, though: if it's not implemented properly then the user may see the same old content each time they visit the site.</p>
<h3 id="heading-gzip-compression">Gzip compression</h3>
<p>Gzip compression is one of the most common recommendations by the Pingdom speed test.</p>
<p>Gzip is a method of compressing files for faster delivery to your users. It is enabled by default by many hosting providers.</p>
<p>If you are using cloud hosting then you are on your own. But enabling Gzip compression will not only decrease the loading speed of your website but also reduce the bandwidth usage of servers.</p>
<p>Here is the code to add in configuration file to enable Gzip compression on Nginx server.</p>
<pre><code class="lang-nginx"><span class="hljs-attribute">gzip</span> <span class="hljs-literal">on</span>;
<span class="hljs-attribute">gzip_disable</span> <span class="hljs-string">"msie6"</span>;
<span class="hljs-attribute">gzip_vary</span> <span class="hljs-literal">on</span>;
<span class="hljs-attribute">gzip_proxied</span> any;
<span class="hljs-attribute">gzip_comp_level</span> <span class="hljs-number">6</span>;
<span class="hljs-attribute">gzip_buffers</span> <span class="hljs-number">16</span> <span class="hljs-number">8k</span>;
<span class="hljs-attribute">gzip_http_version</span> <span class="hljs-number">1</span>.<span class="hljs-number">1</span>;
<span class="hljs-attribute">gzip_types</span> application/javascript application/rss+xml application/vnd.ms-fontobject application/x-font application/x-font-opentype application/x-font-otf application/x-font-truetype application/x-font-ttf application/x-javascript application/xhtml+xml application/xml font/opentype font/otf font/ttf image/svg+xml image/x-icon text/css text/javascript text/plain text/xml;
</code></pre>
<p>Here is the code to add in <code>.htaccess</code> file to enable Gzip on Apache server.</p>
<pre><code class="lang-apacheconf"><span class="hljs-section">&lt;IfModule mod_deflate.c&gt;</span>
    <span class="hljs-attribute">AddOutputFilterByType</span> DEFLATE application/javascript
    <span class="hljs-attribute">AddOutputFilterByType</span> DEFLATE application/rss+xml
    <span class="hljs-attribute">AddOutputFilterByType</span> DEFLATE application/vnd.ms-fontobject
    <span class="hljs-attribute">AddOutputFilterByType</span> DEFLATE application/x-font
    <span class="hljs-attribute">AddOutputFilterByType</span> DEFLATE application/x-font-opentype
    <span class="hljs-attribute">AddOutputFilterByType</span> DEFLATE application/x-font-otf
    <span class="hljs-attribute">AddOutputFilterByType</span> DEFLATE application/x-font-truetype
    <span class="hljs-attribute">AddOutputFilterByType</span> DEFLATE application/x-font-ttf
    <span class="hljs-attribute">AddOutputFilterByType</span> DEFLATE application/x-javascript
    <span class="hljs-attribute">AddOutputFilterByType</span> DEFLATE application/xhtml+xml
    <span class="hljs-attribute">AddOutputFilterByType</span> DEFLATE application/xml
    <span class="hljs-attribute">AddOutputFilterByType</span> DEFLATE font/opentype
    <span class="hljs-attribute">AddOutputFilterByType</span> DEFLATE font/otf
    <span class="hljs-attribute">AddOutputFilterByType</span> DEFLATE font/ttf
    <span class="hljs-attribute">AddOutputFilterByType</span> DEFLATE image/svg+xml
    <span class="hljs-attribute">AddOutputFilterByType</span> DEFLATE image/x-icon
    <span class="hljs-attribute">AddOutputFilterByType</span> DEFLATE text/css
    <span class="hljs-attribute">AddOutputFilterByType</span> DEFLATE text/javascript
    <span class="hljs-attribute">AddOutputFilterByType</span> DEFLATE text/plain
    <span class="hljs-attribute">AddOutputFilterByType</span> DEFLATE text/xml
<span class="hljs-section">&lt;/IfModule&gt;</span>
</code></pre>
<p><a target="_blank" href="https://www.keycdn.com/support/enable-gzip-compression">Source</a>.</p>
<h3 id="heading-amp-for-mobile">AMP for mobile</h3>
<p>I read a <a target="_blank" href="https://kinsta.com/blog/disable-google-amp/">case study</a> that AMP can affect your sales. But as I said earlier in the post you do not need to implement all steps in this post to make your website faster. Just choose wisely.</p>
<p>If you are running a publishing platform like a simple blog then you must go for AMP as it will only benefit you.</p>
<p>AMP also supports ads so this will have the least effect on your earning but the benefits are great. AMP has the fastest loading speed on mobile phones.</p>
<p>Here is a very basic AMP code. You can look <a target="_blank" href="https://amp.dev/documentation/guides-and-tutorials/start/create/">here</a> for complete guide and best practices to create AMP version of your website.</p>
<pre><code class="lang-html"><span class="hljs-meta">&lt;!doctype <span class="hljs-meta-keyword">html</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">html</span> <span class="hljs-attr">amp</span> <span class="hljs-attr">lang</span>=<span class="hljs-string">"en"</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">head</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">meta</span> <span class="hljs-attr">charset</span>=<span class="hljs-string">"utf-8"</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">script</span> <span class="hljs-attr">async</span> <span class="hljs-attr">src</span>=<span class="hljs-string">"https://cdn.ampproject.org/v0.js"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">title</span>&gt;</span>Hello, AMPs<span class="hljs-tag">&lt;/<span class="hljs-name">title</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">link</span> <span class="hljs-attr">rel</span>=<span class="hljs-string">"canonical"</span> <span class="hljs-attr">href</span>=<span class="hljs-string">"https://amp.dev/documentation/guides-and-tutorials/start/create/basic_markup/"</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">meta</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"viewport"</span> <span class="hljs-attr">content</span>=<span class="hljs-string">"width=device-width,minimum-scale=1,initial-scale=1"</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">script</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"application/ld+json"</span>&gt;</span><span class="javascript">
      {
        <span class="hljs-string">"@context"</span>: <span class="hljs-string">"http://schema.org"</span>,
        <span class="hljs-string">"@type"</span>: <span class="hljs-string">"NewsArticle"</span>,
        <span class="hljs-string">"headline"</span>: <span class="hljs-string">"Open-source framework for publishing content"</span>,
        <span class="hljs-string">"datePublished"</span>: <span class="hljs-string">"2015-10-07T12:02:41Z"</span>,
        <span class="hljs-string">"image"</span>: [
          <span class="hljs-string">"logo.jpg"</span>
        ]
      }
    </span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">style</span> <span class="hljs-attr">amp-boilerplate</span>&gt;</span><span class="css"><span class="hljs-selector-tag">body</span>{<span class="hljs-attribute">-webkit-animation</span>:-amp-start <span class="hljs-number">8s</span> <span class="hljs-built_in">steps</span>(<span class="hljs-number">1</span>,end) <span class="hljs-number">0s</span> <span class="hljs-number">1</span> normal both;<span class="hljs-attribute">-moz-animation</span>:-amp-start <span class="hljs-number">8s</span> <span class="hljs-built_in">steps</span>(<span class="hljs-number">1</span>,end) <span class="hljs-number">0s</span> <span class="hljs-number">1</span> normal both;<span class="hljs-attribute">-ms-animation</span>:-amp-start <span class="hljs-number">8s</span> <span class="hljs-built_in">steps</span>(<span class="hljs-number">1</span>,end) <span class="hljs-number">0s</span> <span class="hljs-number">1</span> normal both;<span class="hljs-attribute">animation</span>:-amp-start <span class="hljs-number">8s</span> <span class="hljs-built_in">steps</span>(<span class="hljs-number">1</span>,end) <span class="hljs-number">0s</span> <span class="hljs-number">1</span> normal both}<span class="hljs-keyword">@-webkit-keyframes</span> -amp-start{<span class="hljs-selector-tag">from</span>{<span class="hljs-attribute">visibility</span>:hidden}<span class="hljs-selector-tag">to</span>{<span class="hljs-attribute">visibility</span>:visible}}<span class="hljs-keyword">@-moz-keyframes</span> -amp-start{<span class="hljs-selector-tag">from</span>{<span class="hljs-attribute">visibility</span>:hidden}<span class="hljs-selector-tag">to</span>{<span class="hljs-attribute">visibility</span>:visible}}<span class="hljs-keyword">@-ms-keyframes</span> -amp-start{<span class="hljs-selector-tag">from</span>{<span class="hljs-attribute">visibility</span>:hidden}<span class="hljs-selector-tag">to</span>{<span class="hljs-attribute">visibility</span>:visible}}<span class="hljs-keyword">@-o-keyframes</span> -amp-start{<span class="hljs-selector-tag">from</span>{<span class="hljs-attribute">visibility</span>:hidden}<span class="hljs-selector-tag">to</span>{<span class="hljs-attribute">visibility</span>:visible}}<span class="hljs-keyword">@keyframes</span> -amp-start{<span class="hljs-selector-tag">from</span>{<span class="hljs-attribute">visibility</span>:hidden}<span class="hljs-selector-tag">to</span>{<span class="hljs-attribute">visibility</span>:visible}}</span><span class="hljs-tag">&lt;/<span class="hljs-name">style</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-name">noscript</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-name">style</span> <span class="hljs-attr">amp-boilerplate</span>&gt;</span><span class="css"><span class="hljs-selector-tag">body</span>{<span class="hljs-attribute">-webkit-animation</span>:none;<span class="hljs-attribute">-moz-animation</span>:none;<span class="hljs-attribute">-ms-animation</span>:none;<span class="hljs-attribute">animation</span>:none}</span><span class="hljs-tag">&lt;/<span class="hljs-name">style</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">noscript</span>&gt;</span>
  <span class="hljs-tag">&lt;/<span class="hljs-name">head</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">body</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">h1</span>&gt;</span>Welcome to the mobile web<span class="hljs-tag">&lt;/<span class="hljs-name">h1</span>&gt;</span>
  <span class="hljs-tag">&lt;/<span class="hljs-name">body</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">html</span>&gt;</span>
</code></pre>
<h3 id="heading-wordpress-specific-optimizations">Wordpress specific optimizations</h3>
<h4 id="heading-fewer-plugins">Fewer plugins</h4>
<p>Plugins are the power of WordPress. Or I should say that plugins are the curse of WordPress.</p>
<p>Both depend on the number and quality of plugins you use on your site.</p>
<p>The number of plugins directly affects the loading speed of your website. I always recommend that you use only the necessary plugins and avoid the rest.</p>
<h4 id="heading-a-minimal-theme-will-do-the-work">A minimal theme will do the work</h4>
<p>Let me tell you that your "Popular Wordpress theme" has inbuilt support for most of the popular WordPress plugins that you may never use.</p>
<p>Yes, this is the truth. They have a large number of customers to target so they built a one-stop solution for all (really?).</p>
<p>You should go with a minimal theme which is dedicated for a particular purpose.</p>
<p>If there is no theme that fits best then it is good to create your own theme from scratch. This will be a time-consuming process but it will load assets specific to your needs and will definitely have great speed benefits.</p>
<h4 id="heading-use-autoptimize-plugin">Use Autoptimize plugin</h4>
<p>This is a simple plugin that solves most of the problems with stylesheets and JavaScript files. I got +20 score in Google speed insights right after installing this plugin.</p>
<p>It caches, defers and auto-minifies CSS and JavaScript files which improves page loading speed.</p>
<h4 id="heading-do-you-really-need-wordpress">Do you really need WordPress?</h4>
<p>I know this topic should not be here under WordPress optimizations. But it is important to ask yourself if you really need WordPress.</p>
<p>I love WordPress because it is mature and best for beginners. But sometimes I think it's too heavy for simple tasks.</p>
<p>WordPress is really heavy in its core because it has features for everyone. Whether you want to use these features or not they are there running and eating server resources.</p>
<p>If you need a simple publishing platform with no complex integrations, then these options are good alternatives.</p>
<ul>
<li>Ghost CMS (freeCodeCamp News uses it)</li>
<li>Netlify CMS (Getting popular with Static Site generators).</li>
<li>Gatsby, Hugo, Jekyll (Static site generators)</li>
</ul>
<p>I wanted to include Strapi in the list, but it lacks tutorials and demo. It will get its own place in future web development as its community increases.</p>
<p>To demonstrate the effect here is a screenshot of the speed index on my current site on WordPress and a migrated version on Ghost CMS with a custom theme.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/05/Wordpress-Neve-theme-performance.png" alt="Image" width="600" height="400" loading="lazy">
<em>WordPress Theme performance with 3 additional plugins Installed only for Speed.</em></p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/05/ghost-cms-custom-theme-performance.png" alt="Image" width="600" height="400" loading="lazy">
<em>Ghost CMS custom theme</em></p>
<p>I am by no means biased with anything. There are use cases for each. WordPress can handle complex things easily while Ghost wins for its simplicity and static site generators win on speed.</p>
<p>You can choose the alternatives to WordPress as per your needs.</p>
<h2 id="heading-in-the-end-dont-over-optimize">In the end: don't over-optimize</h2>
<p>Optimizing is good but you should not try to be strict with all the steps. As I mentioned earlier, there is a high chance that certain steps might break your site and lead to hard debugging sessions.</p>
<p>Write out all the steps and then decide if each step is suited for your website or not.</p>
<p>Again, in the end over-optimization is usually bad. Speed is really necessary but on the other hand user experience (UI and UX) also matters a lot.</p>
<p>A good website maintains amazing speed with great UI and UX.</p>
<blockquote>
<p>I  can send you more articles like this with our <a target="_blank" href="https://holycoders.com/newsletter/">Weekly Newsletter</a>.</p>
</blockquote>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to use Lighthouse in CircleCI ]]>
                </title>
                <description>
                    <![CDATA[ By Adam Henson CircleCI is a popular tool for orchestrating CI/CD pipelines. Lighthouse is an open-source project from Google for improving the quality of web pages. It provides user-centric metrics to audit SEO, performance, accessibility, best prac... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-use-lighthouse-in-circleci/</link>
                <guid isPermaLink="false">66d45d6151f567b42d9f841f</guid>
                
                    <category>
                        <![CDATA[ Accessibility ]]>
                    </category>
                
                    <category>
                        <![CDATA[ CircleCI ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Lighthouse ]]>
                    </category>
                
                    <category>
                        <![CDATA[ SEO ]]>
                    </category>
                
                    <category>
                        <![CDATA[ technology ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Website performance ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Mon, 06 Jan 2020 12:00:00 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2020/01/nyc-building-in-midtown-east.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Adam Henson</p>
<p><a target="_blank" href="https://circleci.com/">CircleCI</a> is a popular tool for orchestrating CI/CD pipelines. Lighthouse is an open-source project from Google for improving the quality of web pages. It provides user-centric metrics to audit SEO, performance, accessibility, best practices, and progressive web apps. </p>
<p>For a deeper dive about Lighthouse you can read “<a target="_blank" href="https://www.freecodecamp.org/news/three-ways-to-analyze-website-performance-with-lighthouse-8d100966c04b/">How to analyze website performance with Lighthouse</a>”. </p>
<p>By combining these forces, we can establish website quality automation. This post will demonstrate the following:</p>
<ul>
<li>Basic implementation of Lighthouse in a CircleCI workflow.</li>
<li>Advanced setup to display Lighthouse results in pull request comments.</li>
<li>S3 Lighthouse report uploads.</li>
<li>Slack notifications.</li>
</ul>
<h1 id="heading-lighthouse-check-circleci-orb">Lighthouse Check CircleCI Orb</h1>
<p><a target="_blank" href="https://circleci.com/docs/2.0/orb-intro/#section=configuration">CircleCI Orbs</a> are shareable packages of configuration elements, including jobs, commands, and executors you use in your workflows. This post will provide a guide for using the <a target="_blank" href="https://circleci.com/orbs/registry/orb/foo-software/lighthouse-check">Lighthouse Check CircleCI Orb</a> for automating Lighthouse audits.</p>
<h3 id="heading-basic-example">Basic Example</h3>
<p>Below is a minimal example and all we need to run Lighthouse automatically on any code change ? In this example both <a target="_blank" href="https://www.foo.software"><code>https://www.foo.software</code></a> and <a target="_blank" href="https://www.foo.software/contact"><code>https://www.foo.software/contact</code></a> will be audited.</p>
<pre><code class="lang-yaml"><span class="hljs-attr">version:</span> <span class="hljs-number">2.1</span>

<span class="hljs-attr">orbs:</span>
  <span class="hljs-attr">lighthouse-check:</span> <span class="hljs-string">foo-software/lighthouse-check@0.0.8</span>

<span class="hljs-attr">jobs:</span>
  <span class="hljs-attr">test:</span> 
    <span class="hljs-attr">executor:</span> <span class="hljs-string">lighthouse-check/default</span>
    <span class="hljs-attr">steps:</span>
      <span class="hljs-bullet">-</span> <span class="hljs-attr">lighthouse-check/audit:</span>
          <span class="hljs-attr">urls:</span> <span class="hljs-string">https://www.foo.software,https://www.foo.software/contact</span>

<span class="hljs-attr">workflows:</span>
  <span class="hljs-attr">test:</span>
    <span class="hljs-attr">jobs:</span>
      <span class="hljs-bullet">-</span> <span class="hljs-string">test</span>
</code></pre>
<p>With this minimal setup we have a summary provided in the output of our job. We also have full HTML reports saved as <a target="_blank" href="https://circleci.com/docs/2.0/artifacts/">CircleCI "artifacts"</a>.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/01/circleci-orb-lighthouse-check-output.png" alt="Image" width="600" height="400" loading="lazy">
<em>Lighthouse Check Orb output</em></p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/01/circleci-orb-lighthouse-check-artifacts.png" alt="Image" width="600" height="400" loading="lazy">
<em>Lighthouse Check Orb save artifacts</em></p>
<h3 id="heading-advanced-example">Advanced Example</h3>
<p>Lighthouse Check CircleCI Orb offers a complete set of bells and whistles by utilizing <code>[lighthouse-check](https://github.com/foo-software/lighthouse-check)</code> <a target="_blank" href="https://github.com/foo-software/lighthouse-check">NPM module</a> under the hood. There’s so much more we can do with this. Let’s proceed!</p>
<h2 id="heading-pull-request-comments">Pull Request Comments</h2>
<p>By utilizing this feature, comments are posted with Lighthouse results on every commit. We can do so by following the steps below.</p>
<ol>
<li>Create a new user or find an existing one to act as a “bot”.</li>
<li><a target="_blank" href="https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line">Create a personal access token</a> from this user account.</li>
<li><a target="_blank" href="https://circleci.com/docs/2.0/env-vars/#setting-an-environment-variable-in-a-project">Create a CircleCI environment variable in your project</a> to hold the encrypted value from above. In our example we name it <code>LIGHTHOUSE_CHECK_GITHUB_ACCESS_TOKEN</code>.</li>
<li>Update our config file with the diff shown below.</li>
</ol>
<pre><code class="lang-diff"><span class="hljs-addition">+ prCommentAccessToken: $LIGHTHOUSE_CHECK_GITHUB_ACCESS_TOKEN</span>
<span class="hljs-addition">+ prCommentUrl: https://api.github.com/repos/foo-software/lighthouse-check-orb/pulls/${CIRCLE_PULL_REQUEST##*/}/reviews</span>
urls: https://www.foo.software,https://www.foo.software/contact
</code></pre>
<p>The updates above provides a token to authorize comments on a corresponding pull request. <code>prCommentUrl</code> should be an endpoint in the <a target="_blank" href="https://developer.github.com/v3/pulls/reviews/#create-a-pull-request-review">format specified by the GitHub API</a>. Your endpoint will be similar but with <code>owner</code> and <code>repo</code> params replaced ( <code>foo-software/lighthouse-check-orb</code> ). With this, we’ve created a bot to post Lighthouse results on pull requests ?</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/01/lighthouse-check-pr-comment.png" alt="Image" width="600" height="400" loading="lazy">
<em>Lighthouse Check PR comments</em></p>
<h2 id="heading-s3-report-uploads">S3 Report Uploads</h2>
<p>In our example we persist results by uploading reports as artifacts in our job. This solution could be sufficient in some cases, but artifacts aren’t stored permanently. In order to view reports, we need to navigate into the workflow and manually download reports from the artifact view. </p>
<p>But what if we want a more dependable way of storing and referencing reports? This is where the S3 feature comes into play. We can configure AWS S3 storage by following the below steps.</p>
<ol>
<li><a target="_blank" href="https://aws.amazon.com/premiumsupport/knowledge-center/create-and-activate-aws-account/">Create an AWS account</a> if you don’t already have one.</li>
<li><a target="_blank" href="https://docs.aws.amazon.com/AmazonS3/latest/gsg/SigningUpforS3.html">Create an S3 bucket</a> if you don’t already have one.</li>
<li><a target="_blank" href="https://docs.aws.amazon.com/general/latest/gr/aws-sec-cred-types.html">Acquire an AWS access key id and secret access key</a>.</li>
<li><a target="_blank" href="https://circleci.com/docs/2.0/env-vars/#setting-an-environment-variable-in-a-project">Create a CircleCI environment variables</a> for these two values. In our example we’ll use <code>LIGHTHOUSE_CHECK_AWS_ACCESS_KEY_ID</code> and <code>LIGHTHOUSE_CHECK_AWS_SECRET_ACCESS_KEY</code>, respectively.</li>
<li>Add the bucket name and <a target="_blank" href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html">region</a> (example: <code>us-east-1</code>) as CircleCI environment variables: <code>LIGHTHOUSE_CHECK_AWS_BUCKET</code> and <code>LIGHTHOUSE_CHECK_AWS_REGION</code>.</li>
</ol>
<p>Next, we’ll update our configuration with the following diff.</p>
<pre><code class="lang-diff"><span class="hljs-addition">+ awsAccessKeyId: $LIGHTHOUSE_CHECK_AWS_ACCESS_KEY_ID</span>
<span class="hljs-addition">+ awsBucket: $LIGHTHOUSE_CHECK_AWS_BUCKET</span>
<span class="hljs-addition">+ awsRegion: $LIGHTHOUSE_CHECK_AWS_REGION</span>
<span class="hljs-addition">+ awsSecretAccessKey: $LIGHTHOUSE_CHECK_AWS_SECRET_ACCESS_KEY</span>
prCommentUrl: https://api.github.com/repos/foo-software/lighthouse-check-orb/pulls/${CIRCLE_PULL_REQUEST##*/}/reviews
</code></pre>
<p>In our next commit and push, reports are automatically uploaded to S3 ✅! We also have a them linked in our PR comments.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/01/pr-comment-lighthouse.png" alt="Image" width="600" height="400" loading="lazy">
<em>Lighthouse result PR comment with S3 report linked</em></p>
<h2 id="heading-slack-notifications">Slack Notifications</h2>
<p>What’s a new feature in a DevOps workflow without Slack notifications? A sad one indeed. Let’s ramp things up by adding notifications to a Slack channel for our whole team to see. We can accomplish this in the below steps.</p>
<ol>
<li><a target="_blank" href="https://api.slack.com/messaging/webhooks">Create an “Incoming Webhook” in your Slack workspace and authorize a channel</a>.</li>
<li>Add the Webhook URL as a CircleCI environment variable — <code>LIGHTHOUSE_CHECK_SLACK_WEBHOOK_URL</code>.</li>
</ol>
<pre><code class="lang-diff"><span class="hljs-addition">+ slackWebhookUrl: $LIGHTHOUSE_CHECK_SLACK_WEBHOOK_URL</span>
urls: https://www.foo.software,https://www.foo.software/contact
</code></pre>
<p>Our next commit and push introduces Slack notifications! The “Lighthouse audit” link in the below screenshot navigates to the S3 report as configured ✨</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/01/circleci-orb-lighthouse-check-slack.png" alt="Image" width="600" height="400" loading="lazy">
<em>Lighthouse Slack notification</em></p>
<p>At this point our complete "advanced example" configuration looks like the below.</p>
<pre><code class="lang-yaml"><span class="hljs-attr">usage:</span>
  <span class="hljs-attr">version:</span> <span class="hljs-number">2.1</span>

  <span class="hljs-attr">orbs:</span>
    <span class="hljs-attr">lighthouse-check:</span> <span class="hljs-string">foo-software/lighthouse-check@0.0.8</span>

  <span class="hljs-attr">jobs:</span>
    <span class="hljs-attr">test:</span> 
      <span class="hljs-attr">executor:</span> <span class="hljs-string">lighthouse-check/default</span>
      <span class="hljs-attr">steps:</span>
        <span class="hljs-bullet">-</span> <span class="hljs-attr">lighthouse-check/audit:</span>
            <span class="hljs-attr">awsAccessKeyId:</span> <span class="hljs-string">$LIGHTHOUSE_CHECK_AWS_ACCESS_KEY_ID</span>
            <span class="hljs-attr">awsBucket:</span> <span class="hljs-string">$LIGHTHOUSE_CHECK_AWS_BUCKET</span>
            <span class="hljs-attr">awsRegion:</span> <span class="hljs-string">$LIGHTHOUSE_CHECK_AWS_REGION</span>
            <span class="hljs-attr">awsSecretAccessKey:</span> <span class="hljs-string">$LIGHTHOUSE_CHECK_AWS_SECRET_ACCESS_KEY</span>
            <span class="hljs-attr">prCommentAccessToken:</span> <span class="hljs-string">$LIGHTHOUSE_CHECK_GITHUB_ACCESS_TOKEN</span>
            <span class="hljs-attr">prCommentUrl:</span> <span class="hljs-string">https://api.github.com/repos/foo-software/lighthouse-check-orb/pulls/${CIRCLE_PULL_REQUEST##*/}/reviews</span>
            <span class="hljs-attr">slackWebhookUrl:</span> <span class="hljs-string">$LIGHTHOUSE_CHECK_SLACK_WEBHOOK_URL</span>
            <span class="hljs-attr">urls:</span> <span class="hljs-string">https://www.foo.software,https://www.foo.software/contact</span>

  <span class="hljs-attr">workflows:</span>
    <span class="hljs-attr">test:</span>
      <span class="hljs-attr">jobs:</span>
        <span class="hljs-bullet">-</span> <span class="hljs-string">test</span>
</code></pre>
<h2 id="heading-maintaining-a-historical-record">Maintaining a Historical Record</h2>
<p><a target="_blank" href="https://www.foo.software/lighthouse">Foo’s Automated Lighthouse Check</a> is tool we can use to manage a historical record of Lighthouse audits. We can connect to it with the Lighthouse Check Orb! By doing so you can run Lighthouse remotely versus in a local, dockerized CircleCI environment. With this we can be assured our Lighthouse results aren't flaky from CircleCI infrastructure change. Follow the <a target="_blank" href="https://github.com/foo-software/lighthouse-check-orb#usage-automated-lighthouse-check-api">documented steps to connect with Automated Lighthouse Check</a>.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/01/automated-lighthouse-check.png" alt="Image" width="600" height="400" loading="lazy">
<em>A historical record of Lighthouse audits with "Automated Lighthouse Check"</em></p>
<h1 id="heading-what-now">What Now?</h1>
<p>You can find other of examples of <a target="_blank" href="https://github.com/foo-software/lighthouse-check-orb/tree/master/src/examples">Lighthouse Check Orb usage on GitHub</a>. I hope this article has provided a helpful addition to your DevOps workflow! With Lighthouse integrated in a CI/CD pipeline, we can stay fully equipped to ensure high quality in website SEO, performance, accessibility, best practice, and progressive web apps.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to analyze website performance with Lighthouse ]]>
                </title>
                <description>
                    <![CDATA[ By Adam Henson Audit website performance manually, programmatically, or automatically Cityscape Birds Eye View Lighthouse is an open-source project by Google that gives you a way to measure web page performance. It has configurable settings for repr... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/three-ways-to-analyze-website-performance-with-lighthouse-8d100966c04b/</link>
                <guid isPermaLink="false">66c36340020f8e9c31066e6d</guid>
                
                    <category>
                        <![CDATA[ automation testing  ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Productivity ]]>
                    </category>
                
                    <category>
                        <![CDATA[ SEO ]]>
                    </category>
                
                    <category>
                        <![CDATA[ tech  ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Website performance ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Thu, 11 Apr 2019 14:11:19 +0000</pubDate>
                <media:content url="https://cdn-media-1.freecodecamp.org/images/1*ydkP__0WxXbUl9Jy8D67DA.jpeg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Adam Henson</p>
<h4 id="heading-audit-website-performance-manually-programmatically-or-automatically">Audit website performance manually, programmatically, or automatically</h4>
<p><img src="https://cdn-media-1.freecodecamp.org/images/KZlzVvOb9fZcuBwmwxqRHgrrZyct4MCKNB4X" alt="Image" width="800" height="398" loading="lazy">
<em>Cityscape Birds Eye View</em></p>
<p>Lighthouse is an open-source project by Google that gives you a way to measure web page performance. It has configurable settings for reproducing various conditions. You can set network and device type to simulate, for example.</p>
<blockquote>
<p>You give Lighthouse a URL to audit, it runs a series of audits against the page, and then it generates a report on how well the page did. From there, use the failing audits as indicators on how to improve the page. Each audit has a reference doc explaining why the audit is important, as well as how to fix it. <a target="_blank" href="https://developers.google.com/web/tools/lighthouse/">Lighthouse</a></p>
</blockquote>
<p>There are many reasons why you’d want to measure performance, but one of the most important is about the impact on SEO. I go into more detail about this and how to address certain metrics in <a target="_blank" href="https://medium.freecodecamp.org/taming-performance-in-todays-web-app-with-lighthouse-webpack-and-react-loadable-components-b2d3fa04e0ab">this article</a>.</p>
<h3 id="heading-running-lighthouse-with-chrome-devtools">Running Lighthouse with Chrome DevTools</h3>
<p>You can run performance audits manually with the <a target="_blank" href="https://developers.google.com/web/tools/chrome-devtools/">Chrome DevTools browser extension</a>. Simply fire up the extension from the web page you’d like to test and select the “Audits” panel.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/CoSD1b8oLEO5ahFg4E4dRazNeo7c5L5y5sHo" alt="Image" width="800" height="117" loading="lazy">
<em>Chrome DevTools “Audits” Panel</em></p>
<p>Among a variety of audits, you can choose “performance”. You can also choose to simulate device type and network throttling. Some information specifically about throttling can be found in the <a target="_blank" href="https://github.com/GoogleChrome/lighthouse/blob/master/docs/throttling.md">Lighthouse project Github repo</a>.</p>
<p>Click on “Run audits” next. Upon completion, Lighthouse provides a report within the extension UI.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/rQqYaIzYRyX4kCF5-V4m7sr0MncTgrI9sJf9" alt="Image" width="800" height="361" loading="lazy">
<em>Lighthouse Performance Report</em></p>
<p>This report is a general overview of important metrics, opportunities, and overall performance score. Thumbnails illustrate the lifecycle of page load. What does this all mean? Google provides a plethora of <a target="_blank" href="https://developers.google.com/web/tools/lighthouse/audits">documentation describing each metric</a>, how to address them and the <a target="_blank" href="https://developers.google.com/web/tools/lighthouse/v3/scoring">overall performance score</a>.</p>
<p>In the top left side of Chrome DevTools panel is a download icon that you can use to download the full report in JSON format. You can then use it to create a PDF report via <a target="_blank" href="https://github.com/GoogleChrome/lighthouse#using-the-node-cli">Lighthouse Report Viewer</a>.</p>
<p>Due to the high volume of factors playing into the lifecycle of page load, it’s important to compare results in batches. Taking an average of 5 runs, for example, will provide better insight.</p>
<h3 id="heading-running-lighthouse-programmatically">Running Lighthouse Programmatically</h3>
<p>For our standard “run of the mill” situations, the above should suffice. Another way to run Lighthouse involves installing the open-source package via NPM and following the instructions in the <a target="_blank" href="https://github.com/GoogleChrome/lighthouse#using-the-node-cli">CLI documentation</a>. This can be beneficial if you want to run audits programmatically in a build pipeline, for example.</p>
<p>Similar to the above, you can also run Lighthouse in code by following the <a target="_blank" href="https://github.com/GoogleChrome/lighthouse/blob/master/docs/readme.md#using-programmatically">documentation for using the Node module programmatically</a>. You could create a full-fledged Node.js application with Lighthouse ?!</p>
<h3 id="heading-running-lighthouse-automatically-over-time">Running Lighthouse Automatically Over Time</h3>
<p>So now that we’re pros — let’s take this to the next level. There are many <a target="_blank" href="https://github.com/GoogleChrome/lighthouse#lighthouse-integrations">integrations listed in the Lighthouse documentation</a>, so let’s take a look at one of them.</p>
<h4 id="heading-using-foo-to-run-lighthouse-and-compare-results-over-time">Using “Foo” to Run Lighthouse and Compare Results Over Time</h4>
<p>In an engineering setting where many developers are deploying application changes on a regular basis, it can be important to monitor website performance over time to associate change sets with performance degradation or improvement. Another example would be teams that have initiatives to improve performance for SEO ranking or other reasons. In these situations, it’s critical to monitor website performance over days, weeks, months, etc.</p>
<p>You can add URLs to track at <a target="_blank" href="https://www.foo.software">www.foo.software</a> and monitor performance change. Foo also provides email, Slack or PagerDuty notifications when performance has dropped below a threshold defined by the user, when it’s back to normal, and when improvements are identified automatically!</p>
<p>The best part about it is that you can <a target="_blank" href="https://www.foo.software/register">create an account for free</a>! Once registered and logged in, click the “Pages” link from the top navigation. This is where you can add URLs to monitor. Foo saves results and displays a timeline chart providing a visualization of important metrics. You can toggle through days, weeks, months and drill into detailed reports.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/aMrCtx3sHKfiNW4UbN32f5y7WwUejkJqEKYg" alt="Image" width="800" height="391" loading="lazy">
<em>Amazon Example Foo Lighthouse Timeline Chart</em></p>
<h3 id="heading-conclusion">Conclusion</h3>
<p>Lighthouse is becoming an industry standard in website performance measurement. There are books worth <a target="_blank" href="https://developers.google.com/web/tools/lighthouse/">documentation about Lighthouse that provides details of important metrics</a>.</p>
 ]]>
                </content:encoded>
            </item>
        
    </channel>
</rss>
