Comments (5)
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.
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
from dobyming.github.io.
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.
[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.
I Deployed it, and it quite works well. Here's the Result that I tested in deployed version.
Result
Toggle to Dark Mode, and works well.
Closing this Issue
from dobyming.github.io.
23.05.28
After I merged and deployed this #19, I got 400 Points in LightHouse.π
from dobyming.github.io.
Related Issues (6)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dobyming.github.io.