├── .editorconfig ├── .github ├── FUNDING.yml ├── ISSUE_TEMPLATE.md ├── PULL_REQUEST_TEMPLATE.md └── workflows │ ├── links-checker.yml │ ├── readme-check.yml │ └── stale.yml ├── .gitignore ├── .markdownlint.json ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── images ├── css.png ├── fonts.png ├── html.png ├── images.png ├── javascript.png ├── logo-front-end-performance-checklist.jpg ├── priority │ ├── high.svg │ ├── low.svg │ └── medium.svg └── server-side.png ├── lychee.toml ├── package.json └── pnpm-lock.yaml /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | open_collective: front-end-checklist 2 | github: thedaviddias 3 | thanks_dev: thedaviddias 4 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 3 | 4 | **Fixes**: # 5 | 6 | 🚨 Please review the [guidelines for contributing](../CONTRIBUTING.md) and our [code of conduct](../CODE_OF_CONDUCT.md) to this repository. 🚨 7 | **Please complete these steps and check these boxes (by putting an x inside the brackets) before filing your PR:** 8 | 9 | - [ ] Check the commit's or even all commits' message styles matches our requested structure. 10 | - [ ] Check your code additions will fail neither code linting checks nor unit test. 11 | 12 | #### Short description of what this resolves: 13 | 14 | 15 | #### Proposed changes: 16 | 17 | - 18 | - 19 | - 20 | 21 | 👍 Thank you! 22 | -------------------------------------------------------------------------------- /.github/workflows/links-checker.yml: -------------------------------------------------------------------------------- 1 | name: Links Checker 2 | 3 | on: 4 | repository_dispatch: 5 | workflow_dispatch: 6 | schedule: 7 | - cron: '0 0 * * 1' # bi weekly on Monday 8 | 9 | env: 10 | HUSKY: 0 11 | 12 | jobs: 13 | links-checker: 14 | runs-on: ubuntu-latest 15 | name: Links Checker 16 | permissions: 17 | issues: write 18 | 19 | steps: 20 | - uses: actions/checkout@v4 21 | 22 | - name: Link Checker 23 | id: lychee 24 | uses: lycheeverse/lychee-action@v2.0.2 25 | with: 26 | args: --config ./lychee.toml --verbose --no-progress README.md 27 | fail: true 28 | 29 | - name: Create Issue From File 30 | if: env.exit_code != 0 31 | uses: peter-evans/create-issue-from-file@v5 32 | with: 33 | title: Link Checker Report 34 | content-filepath: ./lychee-out.md 35 | labels: report, automated issue 36 | -------------------------------------------------------------------------------- /.github/workflows/readme-check.yml: -------------------------------------------------------------------------------- 1 | name: Readme Check 2 | 3 | on: 4 | push: 5 | paths: 6 | - './README.md' 7 | pull_request: 8 | paths: 9 | - './README.md' 10 | 11 | env: 12 | HUSKY: 0 13 | 14 | jobs: 15 | readme-check: 16 | runs-on: ubuntu-latest 17 | name: Readme Check 18 | 19 | steps: 20 | - uses: actions/checkout@v4 21 | 22 | - name: Setup Node.js 23 | uses: actions/setup-node@v4 24 | with: 25 | node-version: '22' 26 | 27 | - name: Setup pnpm 28 | uses: pnpm/action-setup@v4 29 | with: 30 | version: 9 31 | 32 | - name: Install dependencies 33 | run: pnpm i 34 | 35 | - name: Check Markdown formatting 36 | run: pnpm format:check 37 | 38 | - name: Lint Markdown 39 | run: pnpm lint:md 40 | 41 | - name: Link Checker 42 | uses: lycheeverse/lychee-action@v2.0.2 43 | with: 44 | args: --config ./lychee.toml --verbose --no-progress README.md 45 | fail: true 46 | -------------------------------------------------------------------------------- /.github/workflows/stale.yml: -------------------------------------------------------------------------------- 1 | name: 'Close stale issues and PRs' 2 | 3 | on: 4 | schedule: 5 | - cron: '30 1 * * 6' 6 | workflow_dispatch: 7 | 8 | permissions: 9 | issues: write 10 | pull-requests: write 11 | 12 | jobs: 13 | stale: 14 | runs-on: ubuntu-latest 15 | 16 | steps: 17 | - uses: actions/stale@v8 18 | with: 19 | stale-issue-message: 'This issue has been automatically marked as stale because it has been open 40 days with no activity. Remove stale label or comment or this will be closed in 10 days. Thank you for your contributions!' 20 | stale-pr-message: 'This PR has been automatically marked as stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days.' 21 | close-issue-message: 'This issue was closed because it has been stalled for 10 days with no activity. You can always contact the maintainers directly for more information.' 22 | close-pr-message: 'This PR was closed because it has been stalled for 10 days with no activity. You can always contact the maintainers directly for more information.' 23 | days-before-stale: 40 24 | days-before-pr-stale: 45 25 | days-before-close: 10 26 | exempt-issue-assignees: 'thedaviddias' 27 | exempt-pr-assignees: 'thedaviddias' 28 | exempt-all-pr-assignees: true 29 | stale-issue-label: 'stale' 30 | stale-pr-label: 'stale' 31 | exempt-pr-labels: 'keep-unstale,security,dependabot,wip,need-help' 32 | exempt-issue-labels: 'keep-unstale,security' 33 | close-issue-label: 'wontfix' 34 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | .lycheecache 4 | lychee-out.md 5 | -------------------------------------------------------------------------------- /.markdownlint.json: -------------------------------------------------------------------------------- 1 | { 2 | "MD013": false, 3 | "MD024": false, 4 | "MD033": false 5 | } 6 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to make participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. 6 | 7 | ## Our Standards 8 | 9 | Examples of behavior that contributes to creating a positive environment include: 10 | 11 | * Using welcoming and inclusive language 12 | * Being respectful of differing viewpoints and experiences 13 | * Gracefully accepting constructive criticism 14 | * Focusing on what is best for the community 15 | * Showing empathy towards other community members 16 | 17 | Examples of unacceptable behavior by participants include: 18 | 19 | * The use of sexualized language or imagery and unwelcome sexual attention or advances 20 | * Trolling, insulting/derogatory comments, and personal or political attacks 21 | * Public or private harassment 22 | * Publishing others' private information, such as a physical or electronic address, without explicit permission 23 | * Other conduct which could reasonably be considered inappropriate in a professional setting 24 | 25 | ## Our Responsibilities 26 | 27 | Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. 28 | 29 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. 30 | 31 | ## Scope 32 | 33 | This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. 34 | 35 | ## Enforcement 36 | 37 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at thedaviddias@gmail.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. 38 | 39 | Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. 40 | 41 | ## Attribution 42 | 43 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] 44 | 45 | [homepage]: http://contributor-covenant.org 46 | [version]: http://contributor-covenant.org/version/1/4/ 47 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contribute 2 | 3 | ## Introduction 4 | 5 | First, thank you for considering contributing to the Front-End Performance Checklist! It's people like you that make the open source community such a great community! 😊 6 | 7 | We welcome any type of contribution, not only code. You can help with 8 | - **QA**: file bug reports, the more details you can give the better (e.g. screenshots with the console open) 9 | - **Marketing**: writing blog posts, howto's, printing stickers, ... 10 | - **Community**: presenting the project at meetups, organizing a dedicated meetup for the local community, ... 11 | - **Code**: take a look at the [open issues](https://github.com/thedaviddias/Front-End-Performance-Checklist/issues). Even if you can't write code, commenting on them, showing that you care about a given issue matters. It helps us triage them. 12 | 13 | ## Your First Contribution 14 | 15 | Working on your first Pull Request? You can learn how from this *free* series, [How to Contribute to an Open Source Project on GitHub](https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github). 16 | 17 | ## Submitting code 18 | 19 | Any code change should be submitted as a pull request. The description should explain what the code does and give steps to execute it. The pull request should also contain tests. 20 | 21 | ## Code review process 22 | 23 | The bigger the pull request, the longer it will take to review and merge. Try to break down large pull requests in smaller chunks that are easier to review and merge. 24 | It is also always helpful to have some context for your pull request. What was the purpose? Why does it matter to you? 25 | 26 | ## Questions 27 | 28 | If you have any questions, create an [issue](issue) (protip: do a quick search first to see if someone else didn't ask the same question before!). 29 | You can also reach us at thedaviddias@gmail.com. 30 | 31 | 32 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018-2024 David Dias 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 🎮 Front-End Performance Checklist 2 | 3 | The only Front-End Performance Checklist that runs faster than the others! 4 | 5 | Performance is a huge subject, but it's not always a "back-end" or an "admin" topic: it's a Front-End responsibility too. The Front-End Performance Checklist is an exhaustive list of elements you should check or at least be aware of, as a Front-End developer and apply to your project (personal and professional). 6 | 7 | > One simple rule: "Design and code with performance in mind" 8 | 9 | **Other Checklists:** 10 | 11 | - [🗂 Front-End Checklist](https://github.com/thedaviddias/Front-End-Checklist#front-end-checklist) 12 | - [💎 Front-End Design Checklist](https://github.com/thedaviddias/Front-End-Design-Checklist#front-end-design-checklist) 13 | 14 | > [!TIP] 15 | > ⭐️ I've recently launched [UX Patterns for Devs](https://git.new/uxpatterns) and a [curated list for indie developers](https://git.new/indiedevtoolkit), feel free to check it out! ⭐️ 16 | 17 | ## 📚 Table of Contents 18 | 19 | - [How to use?](#how-to-use) 20 | - [HTML](#html) 21 | - [CSS](#css) 22 | - [Fonts](#fonts) 23 | - [Images](#images) 24 | - [JavaScript](#javascript) 25 | - [Performance Tools](#performance-tools) 26 | - [References](#references) 27 | 28 | ## How to use? 29 | 30 | For each rule, you will have a paragraph explaining _why_ this rule is important and _how_ you can fix it. For more deep information, you should find links that will point to 🛠 tools, 📖 articles or 📹 medias that can complete the checklist. 31 | 32 | All items in the **Front-End Performance Checklist** are essentials to achieve the highest performance score but you would find an indicator to help you to eventually prioritised some rules amount others. There are 3 levels of priority: 33 | 34 | - ![Low][low] means that the item has a **low** priority. 35 | - ![Medium][medium] means that the item has a **medium** priority. You shouldn't avoid tackling that item. 36 | - ![High][high] means that the item has a **high** priority. You can't avoid following that rule and implement the corrections recommended. 37 | 38 | ### Performance tools 39 | 40 | List of the tools you can use to test or monitor your website or application: 41 | 42 | - 🛠 [WebPagetest - Website Performance and Optimization Test](https://www.webpagetest.org/) 43 | - 🛠 ☆ [Dareboost: Website Speed Test and Website Analysis](https://www.dareboost.com/) (use the coupon WPCDD20 for -20%) 44 | - 🛠 [Treo: Page Speed Monitoring](https://treo.sh/?ref=perfchecklist) 45 | - 🛠 [GTmetrix | Website Speed and Performance Optimization](https://gtmetrix.com/) 46 | - 🛠 [PageSpeed Insights](https://developers.google.com/speed/pagespeed/insights/) 47 | - 🛠 [Web.dev](https://web.dev/measure) 48 | - 🛠 [Pingdom Website Speed Test](https://tools.pingdom.com) 49 | - 📖 [Make the Web Faster | Google Developers](https://developers.google.com/speed/) 50 | - 🛠 [Sitespeed.io - Welcome to the wonderful world of Web Performance](https://www.sitespeed.io/) 51 | - 🛠 [Calibre](https://calibreapp.com/) 52 | - 🛠 [Website Speed Test | Check Web Performance » Dotcom-Tools](https://www.dotcom-tools.com/website-speed-test.aspx) 53 | - 🛠 [Website and Server Uptime Monitoring - Pingdom](https://www.pingdom.com/product/uptime-monitoring/) ([Free Signup Link](https://www.pingdom.com/free)) 54 | - 🛠 [Uptime Robot](https://uptimerobot.com) 55 | - 🛠 [SpeedCurve: Monitor front-end performance](https://speedcurve.com) 56 | - 🛠 [PWMetrics - CLI tool and lib to gather performance metrics](https://github.com/paulirish/pwmetrics) 57 | - 🛠 [Lighthouse - Google](https://developers.google.com/web/tools/lighthouse/#devtools) 58 | - 🛠 [Checkbot browser extension - Checks for web performance best practices](https://www.checkbot.io/) 59 | - 🛠 [Yellow Lab Tools | Online test to help speeding up heavy web pages](https://yellowlab.tools/) 60 | - 🛠 [Speedrank - Web Performance Monitoring](https://speedrank.app/) 61 | - 🛠 [DebugBear - Monitor website performance and Lighthouse scores](https://www.debugbear.com/) 62 | - 🛠 [Gravity CI - Check your build artifacts sizes on every pull request.](https://gravity.ci/) 63 | - 🛠 [Exthouse - Analyze the impact of a browser extension on web performance](https://github.com/treosh/exthouse) 64 | - 🛠 [LogRocket - Measure front-end performance in production apps](https://logrocket.com) 65 | 66 | ### References 67 | 68 | - 📖 [The Cost Of JavaScript](https://medium.com/@addyosmani/the-cost-of-javascript-in-2018-7d8950fbb5d4) 69 | - [AddyOsmani.com - Start Performance Budgeting](https://addyosmani.com/blog/performance-budgets/) 70 | - 📖 [Get Started With Analyzing Runtime Performance  |  Google Developers](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/) 71 | - 📖 [State of the Web | 2018_01_01](https://httparchive.org/reports/state-of-the-web?start=2018_01_01) 72 | - 📖 [Page Weight Doesn't Matter](https://www.speedshop.co/2015/11/05/page-weight-doesnt-matter.html) 73 | - 📖 [Front-End Performance Checklist 2021 [PDF, Apple Pages, MS Word]](https://www.smashingmagazine.com/2021/01/front-end-performance-2021-free-pdf-checklist/) 74 | - 📖 [Designing for Performance Weighing Aesthetics and Speed - By Lara Callender Hogan [eBook, Print]](http://designingforperformance.com/index.html) 75 | - 📖 [fabkrum/web-performance-resources: Up to date collection of valuable web performance resources](https://github.com/fabkrum/web-performance-resources) 76 | - 📖 [Checkbot - Web Speed Best Practices](https://www.checkbot.io/guide/speed/) 77 | - 🛠 [Progressive Tooling - A list of community-built, third-party tools that can be used to improve page performance](https://progressivetooling.com/) 78 | 79 | ## HTML 80 | 81 | ![html] 82 | 83 | - [ ] **Minified HTML:** ![medium] The HTML code is minified, comments, white spaces and new lines are removed from production files. 84 | 85 | _Why:_ 86 | 87 | > Removing all unnecessary spaces, comments and attributes will reduce the size of your HTML and speed up your site's page load times and obviously lighten the download for your user. 88 | 89 | _How:_ 90 | 91 | > Most of the frameworks have plugins to facilitate the minification of the webpages. You can use a bunch of NPM modules that can do the job for you automatically. 92 | 93 | - 🛠 [HTML minifier | Minify Code](http://minifycode.com/html-minifier/) 94 | - 🛠 [Online HTML Compressor](http://refresh-sf.com) 95 | - 📖 [Experimenting with HTML minifier — Perfection Kills](http://perfectionkills.com/experimenting-with-html-minifier/#use_short_doctype) 96 | 97 | - [ ] **Place CSS tags always before JavaScript tags:** ![high] Ensure that your CSS is always loaded before having JavaScript code. 98 | 99 | ```html 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | ``` 110 | 111 | _Why:_ 112 | 113 | > Having your CSS tags before any JavaScript enables better, parallel download which speed up browser rendering time. 114 | 115 | _How:_ 116 | 117 | > ⁃ Ensure that `` and `` in a single line (minified if possible). 220 | 221 | _Why:_ 222 | 223 | > Inlining critical CSS help to speed up the rendering of the web pages reducing the number of requests to the server. 224 | 225 | _How:_ 226 | 227 | > Generate the CSS critical with online tools or using a plugin like the one that Addy Osmani developed. 228 | 229 | - 📖 [Understanding Critical CSS](https://www.smashingmagazine.com/2015/08/understanding-critical-css/) 230 | - 🛠 [Critical by Addy Osmani on GitHub](https://github.com/addyosmani/critical) automates this. 231 | - 📖 [Inlining critical CSS for better web performance | Go Make Things](https://gomakethings.com/inlining-critical-css-for-better-web-performance/) 232 | - 🛠 [Critical Path CSS Generator - Prioritize above the fold content :: SiteLocity](https://www.sitelocity.com/critical-path-css-generator) 233 | - 📖 [Reduce the size of the above-the-fold content](https://developers.google.com/speed/docs/insights/PrioritizeVisibleContent) 234 | 235 | - [ ] **Embedded or inline CSS:** ![high] Avoid using embed or inline CSS inside your `` \_(Not valid for HTTP/2) 236 | 237 | _Why:_ 238 | 239 | > One of the first reason it's because it's a good practice to **separate content from design**. It also helps you have a more maintainable code and keep your site accessible. But regarding performance, it's simply because it decreases the file-size of your HTML pages and the load time. 240 | 241 | _How:_ 242 | 243 | > Always use external stylesheets or embed CSS in your `` (and follow the others CSS performance rules) 244 | 245 | - [ ] **Analyse stylesheets complexity:** ![high] Analyzing your stylesheets can help you to flag issues, redundancies and duplicate CSS selectors. 246 | 247 | _Why:_ 248 | 249 | > Sometimes you may have redundancies or validation errors in your CSS, analysing your CSS files and removed these complexities can help you to speed up your CSS files (because your browser will read them faster) 250 | 251 | _How:_ 252 | 253 | > Your CSS should be organized, using a CSS preprocessor can help you with that. Some online tools listed below can also help you analysing and correct your code. 254 | 255 | - 🛠 [TestMyCSS | Optimize and Check CSS Performance](http://www.testmycss.com/) 256 | - 🛠 [CSS Stats](https://cssstats.com/) 257 | - 🛠 [macbre/analyze-css: CSS selectors complexity and performance analyzer](https://github.com/macbre/analyze-css) 258 | - 🛠 [Project Wallace](https://www.projectwallace.com/) is like CSS Stats but stores stats over time so you can track your changes 259 | 260 | **[⬆ back to top](#-table-of-contents)** 261 | 262 | ## Fonts 263 | 264 | ![fonts] 265 | 266 | - 📖 [A Book Apart, Webfont Handbook](https://abookapart.com/products/webfont-handbook) 267 | 268 | - [ ] **Webfont formats:** ![medium] You are using WOFF2 on your web project or application. 269 | 270 | _Why:_ 271 | 272 | > According to Google, the WOFF 2.0 Web Font compression format offers 30% average gain over WOFF 1.0. It's then good to use WOFF 2.0, WOFF 1.0 as a fallback and TTF. 273 | 274 | _How:_ 275 | 276 | > Check before buying your new font that the provider gives you the WOFF2 format. If you are using a free font, you can always use Font Squirrel to generate all the formats you need. 277 | 278 | - 📖 [WOFF 2.0 – Learn more about the next generation Web Font Format and convert TTF to WOFF2](https://gist.github.com/sergejmueller/cf6b4f2133bcb3e2f64a) 279 | - 🛠 [Create Your Own @font-face Kits » Font Squirrel](https://www.fontsquirrel.com/tools/webfont-generator) 280 | - 🛠 [IcoMoon App - Icon Font, SVG, PDF & PNG Generator](https://icomoon.io/app/) 281 | - 📖 [Using @font-face | CSS-Tricks](https://css-tricks.com/snippets/css/using-font-face/?ref=frontendchecklist) 282 | - 📖 [Can I use... WOFF2](https://caniuse.com/woff2) 283 | 284 | - [ ] **Use `preconnect` to load your fonts faster:** ![medium] 285 | 286 | ```html 287 | 288 | ``` 289 | 290 | _Why:_ 291 | 292 | > When you arrived on a website, your device needs to find out where your site lives and which server it needs to connect with. Your browser had to contact a DNS server and wait for the lookup complete before fetching the resource (fonts, CSS files...). Prefetches and preconnects allow the browser to lookup the DNS information and start establishing a TCP connection to the server hosting the font file. This provides a performance boost because by the time the browser gets around to parsing the css file with the font information and discovering it needs to request a font file from the server, it will already have pre-resolved the DNS information and have an open connection to the server ready in its connection pool. 293 | 294 | _How:_ 295 | 296 | > ⁃ Before prefetching your webfonts, use webpagetest to evaluate your website
297 | > ⁃ Look for teal colored DNS lookups and note the host that are being requested
298 | > ⁃ Prefetch your webfonts in your `` and add eventually these hostnames that you should prefetch too 299 | 300 | - 📖 [Faster Google Fonts with Preconnect - CDN Planet](https://www.cdnplanet.com/blog/faster-google-webfonts-preconnect/) 301 | - 📖 [Make Your Site Faster with Preconnect Hints | Viget](https://www.viget.com/articles/make-your-site-faster-with-preconnect-hints/) 302 | - 📖 [Ultimate Guide to Browser Hints: Preload, Prefetch, and Preconnect - MachMetrics Speed Blog](https://www.machmetrics.com/speed-blog/guide-to-browser-hints-preload-preconnect-prefetch/) 303 | - 📖 [A Comprehensive Guide to Font Loading Strategies—zachleat.com](https://www.zachleat.com/web/comprehensive-webfonts/#font-face) 304 | - 🛠 [typekit/webfontloader: Web Font Loader gives you added control when using linked fonts via @font-face.](https://github.com/typekit/webfontloader) 305 | 306 | - [ ] **Webfont size:** ![medium] Webfont sizes don't exceed 300kb (all variants included) 307 | 308 | - 📖 [Font Bytes - Page Weight](https://httparchive.org/reports/page-weight#bytesFont) 309 | 310 | - [ ] **Prevent Flash or Invisible Text:** ![medium] Avoid transparent text until the Webfont is loaded 311 | 312 | - 📖 [`font-display` for the Masses](https://css-tricks.com/font-display-masses/) 313 | - 📖 [CSS font-display: The Future of Font Rendering on the Web](https://www.sitepoint.com/css-font-display-future-font-rendering-web/) 314 | 315 | **[⬆ back to top](#-table-of-contents)** 316 | 317 | ## Images 318 | 319 | ![images] 320 | 321 | - 📖 [Image Bytes in 2018](https://httparchive.org/reports/page-weight#bytesImg) 322 | 323 | - [ ] **Images optimization:** ![high] Your images are optimized, compressed without direct impact to the end user. 324 | 325 | _Why:_ 326 | 327 | > Optimized images load faster in your browser and consume less data. 328 | 329 | _How:_ 330 | 331 | > ⁃ Try using CSS3 effects when it's possible (instead of a small image)
332 | > ⁃ When it's possible, use fonts instead of text encoded in your images
333 | > ⁃ Use SVG
334 | > ⁃ Use a tool and specify a level compression under 85. 335 | 336 | - 📖 [Image Optimization | Web Fundamentals | Google Developers](https://developers.google.com/web/fundamentals/performance/optimizing-content-efficiency/image-optimization) 337 | - 📖 [Essential Image Optimization - An eBook by Addy Osmani](https://images.guide/) 338 | - 🛠 [TinyJPG – Compress JPEG images intelligently](https://tinyjpg.com/) 339 | - 🛠 [Kraken.io - Online Image Optimizer](https://kraken.io/web-interface) 340 | - 🛠 [Compressor.io - optimize and compress JPEG photos and PNG images](https://compressor.io/compress) 341 | - 🛠 [Cloudinary - Image Analysis Tool](https://webspeedtest.cloudinary.com) 342 | - 🛠 [ImageEngine - Image Webpage Loading Test](https://demo.imgeng.in) 343 | - 🛠 [SVGOMG - Optimize SVG vector graphics files](https://jakearchibald.github.io/svgomg/) 344 | 345 | - [ ] **Images format:** ![high] Choose your image format appropriately. 346 | 347 | _Why:_ 348 | 349 | > To ensure that your images don't slow your website, choose the format that will correspond to your image. If it's a photo, JPEG is most of the time more appropriate than PNG or GIF. But don't forget to look a the nex-gen formats which can reduce the size of your files. Each image format has pros and cons, it's important to know these to make the best choice possible. 350 | 351 | _How:_ 352 | 353 | > ⁃ Use [Lighthouse](https://developers.google.com/web/tools/lighthouse/) to identify which images can eventually use **next-gen formats** (like JPEG 2000m JPEG XR or WebP)
354 | > ⁃ Compare different formats, sometimes using PNG8 is better than PNG16, sometimes it's not. 355 | 356 | - 📖 [Serve Images in Next-Gen Formats  |  Tools for Web Developers  |  Google Developers](https://developers.google.com/web/tools/lighthouse/audits/webp) 357 | - 📖 [What Is the Right Image Format for Your Website? — SitePoint](https://www.sitepoint.com/what-is-the-right-image-format-for-your-website/) 358 | - 📖 [PNG8 - The Clear Winner — SitePoint](https://www.sitepoint.com/png8-the-clear-winner/) 359 | - 📖 [8-bit vs 16-bit - What Color Depth You Should Use And Why It Matters - DIY Photography](https://www.diyphotography.net/8-bit-vs-16-bit-color-depth-use-matters/) 360 | 361 | - [ ] **Use vector image vs raster/bitmap:** ![medium] Prefer using vector image rather than bitmap images (when possible). 362 | 363 | _Why:_ 364 | 365 | > Vector images (SVG) tend to be smaller than images and SVG's are responsive and scale perfectly. These images can be animated and modified by CSS. 366 | 367 | - [ ] **Images dimensions:** ![medium] Set `width` and `height` attributes on `` if the final rendered image size is known. 368 | 369 | _Why:_ 370 | 371 | > If height and width are set, the space required for the image is reserved when the page is loaded. However, without these attributes, the browser does not know the size of the image, and cannot reserve the appropriate space to it. The effect will be that the page layout will change during loading (while the images load). 372 | 373 | - [ ] **Avoid using Base64 images:** ![medium] You could eventually convert tiny images to base64 but it's actually not the best practice. 374 | 375 | - 📖 [Base64 Encoding & Performance, Part 1 and 2 by Harry Roberts](https://csswizardry.com/2017/02/base64-encoding-and-performance/) 376 | - 📖 [A closer look at Base64 image performance – The Page Not Found Blog](http://www.andygup.net/a-closer-look-at-base64-image-performance/) 377 | - 📖 [When to base64 encode images (and when not to) | David Calhoun](https://www.davidbcalhoun.com/2011/when-to-base64-encode-images-and-when-not-to/) 378 | 379 | - [ ] **Lazy loading:** ![medium] Offscreen images are loaded lazily (A noscript fallback is always provided). 380 | 381 | _Why:_ 382 | 383 | > It will improve the response time of the current page and then avoid loading unnecessary images that the user may not need. 384 | 385 | _How:_ 386 | 387 | > ⁃ Use [Lighthouse](https://developers.google.com/web/tools/lighthouse/) to identify how many **images are offscreen**.
388 | > ⁃ Use a JavaScript plugin like the following to lazyload your images. Make sure you target offscreen images only.
389 | > ⁃ Also make sure to lazyload alternative images shown at mouseover or upon other user actions. 390 | 391 | - 🛠 [verlok/lazyload: GitHub](https://github.com/verlok/lazyload) 392 | - 🛠 [aFarkas/lazysizes: GitHub](https://github.com/aFarkas/lazysizes/) 393 | - 🛠 [mfranzke/loading-attribute-polyfill: GitHub](https://github.com/mfranzke/loading-attribute-polyfill/) 394 | - 📖 [Lazy Loading Images and Video  |  Web Fundamentals  |  Google Developers](https://developers.google.com/web/fundamentals/performance/lazy-loading-guidance/images-and-video/) 395 | - 📖 [5 Brilliant Ways to Lazy Load Images For Faster Page Loads - Dynamic Drive Blog](http://blog.dynamicdrive.com/5-brilliant-ways-to-lazy-load-images-for-faster-page-loads/) 396 | 397 | - [ ] **Responsive images:** ![medium] Ensure to serve images that are close to your display size. 398 | 399 | _Why:_ 400 | 401 | > Small devices don't need images bigger than their viewport. It's recommended to have multiple versions of one image on different sizes. 402 | 403 | _How:_ 404 | 405 | > ⁃ Create different image sizes for the devices you want to target.
406 | > ⁃ Use `srcset` and `picture` to deliver multiple variants of each image. 407 | 408 | - 📖 [Responsive images - Learn web development | MDN](https://developer.mozilla.org/en-US/docs/Learn/HTML/Multimedia_and_embedding/Responsive_images) 409 | 410 | **[⬆ back to top](#-table-of-contents)** 411 | 412 | ## JavaScript 413 | 414 | ![javascript] 415 | 416 | - [ ] **JS Minification:** ![high] All JavaScript files are minified, comments, white spaces and new lines are removed from production files _(still valid if using HTTP/2)_. 417 | 418 | _Why:_ 419 | 420 | > Removing all unnecessary spaces, comments and break will reduce the size of your JavaScript files and speed up your site's page load times and obviously lighten the download for your user. 421 | 422 | _How:_ 423 | 424 | > ⁃ Use the tools suggested below to minify your files automatically before or during your build or your deployment. 425 | 426 | - 🛠 [uglify-js - npm](https://www.npmjs.com/package/uglify-js) 427 | - 🛠 [Online JavaScript Compressor](http://refresh-sf.com) 428 | 429 | - [ ] **No JavaScript inside:** ![medium] _(Only valid for website)_ Avoid having multiple JavaScript codes embedded in the middle of your body. Regroup your JavaScript code inside external files or eventually in the `` or at the end of your page (before ``). 430 | 431 | _Why:_ 432 | 433 | > Placing JavaScript embedded code directly in your `` can slow down your page because it loads while the DOM is being built. The best option is to use external files with `async` or `defer` to avoid blocking the DOM. Another option is to place some scripts inside your ``. Most of the time analytics code or small script that need to load before the DOM gets to main processing. 434 | 435 | _How:_ 436 | 437 | > Ensure that all your files are loaded using `async` or `defer` and decide wisely the code that you will need to inject in your ``. 438 | 439 | - 📖 [11 Tips to Optimize JavaScript and Improve Website Loading Speeds](https://www.upwork.com/hiring/development/11-tips-to-optimize-javascript-and-improve-website-loading-speeds/) 440 | 441 | - [ ] **Non-blocking JavaScript:** ![high] JavaScript files are loaded asynchronously using `async` or deferred using `defer` attribute. 442 | 443 | ```html 444 | 445 | 446 | 447 | 448 | 449 | ``` 450 | 451 | _Why:_ 452 | 453 | > JavaScript blocks the normal parsing of the HTML document, so when the parser reaches a `