Git Product home page Git Product logo

Comments (5)

dobyming avatar dobyming commented on May 19, 2024

I found good article that explains why this effect happens. related Post - why font-awesome-icon flicker

Cause

Instead, they are downloaded through a separate network request and then inserted into the document using Javascript. It’s essentially DOM manipulation, which is how React (which underlies Gatsby) works. Only this time, instead of manipulating UI elements like <div>, it is inserting a <style> element. Essentially, the styles are downloaded externally and inserted into the document through DOM manipulation.

Fix

To fix this, we simply need the style rules to be β€œtruly inline” β€” that is, they should be bundled with the original HTML document such that they are already active on render.

I'm gonna Ref this PR and try to solve the issue,, In Gatsby How to set SVG Icon Config settings
https://www.osiux.ws/blog/get-rid-of-huge-font-awesome-icons-on-gatsby

from dobyming.github.io.

dobyming avatar dobyming commented on May 19, 2024

Handle FontAwesome Icon Flicker Issue by adding this code in gatsby-browser.js

import 'prismjs/themes/prism-tomorrow.css';
// added Code
import '@fortawesome/fontawesome-svg-core/styles.css'
import { config } from '@fortawesome/fontawesome-svg-core'

config.autoAddCss = false;

Result

2023-05-27 13;52;40

from dobyming.github.io.

dobyming avatar dobyming commented on May 19, 2024

By adding gatsby-plugin-offline, It stores static assets in Service worker. so when User Reload the page, it refer assets that stores in cache, so the flickering effects shrinks than previous version I released.

2023-05-27 23;58;51

[Ref]
https://www.freecodecamp.org/news/how-to-enable-offline-mode-for-gatsby-site/
https://developer.chrome.com/docs/workbox/service-worker-overview/

from dobyming.github.io.

dobyming avatar dobyming commented on May 19, 2024

I Deployed it, and it quite works well. Here's the Result that I tested in deployed version.

Result

2023-05-28 13;40;55

Toggle to Dark Mode, and works well.

2023-05-28 13;42;07

Closing this Issue

from dobyming.github.io.

dobyming avatar dobyming commented on May 19, 2024

23.05.28

After I merged and deployed this #19, I got 400 Points in LightHouse.😊

2023-05-28 13;48;38

from dobyming.github.io.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.