Comments (2)
Hi Jason 🙂
Thank you for setting aside a page to investigate the issue, that's really helpful 👍
Regarding your FOUC: I could reproduce it unreliably. What I could see, however, is this: When throttling to GPRS, your main assets load in this order:
- combined.css
- jquery.js
- grouped.js
Without throttling, the order is such:
- jquery.js
- grouped.js
- combined.css
I could even observe combined.css
getting loaded after the document's load
event.
So, it looks like you trigger the transition from spinner to normal view in grouped.js
before combined.css
has finished loading, which will cause a FOUC. This is no bug in loadCSS, which looks to be working fine.
You have several options:
- make your script aware of your stylesheet's load-completion
- extent your
<style>
to include the critical styles forl-wrapper
- load the stylesheet synchronously
- inline all your styles
Seeing as you have a one-pager here, I'd just inline your stylesheets. That way you prevent any FOUC, have one less HTTP request, and can leave out the loadCSS overhead.
Hope this helps 🙂👍
By the way: I'd also hide l-wrapper
in such a way that the page doesn't scroll until page-loader
is removed. Alternatively, make page-loader
position: fixed
instead of position: absolute
.
from loadcss.
Thank you so much for the insightful feedback. I'm investigating now and may come back with follow-up questions. Greatly appreciated!
from loadcss.
Related Issues (20)
- Polyfill has an issue in chrome
- Optionally preload without as attr?
- Don't rely on invalid media attributes to download? HOT 10
- standalone or via npm?
- element with id `global` prevents loadCSS execution
- Error thrown by Content-Security-Policy HOT 5
- Supports preload
- Cannot use inline 'onload' because of CSP HOT 6
- The plugin doesn't do anything to preload elements in Firefox HOT 1
- Cannot install version 3.0.0 because node version is hardcoded to 11.9.0 HOT 5
- Where has the cssrelpreload polyfill gone in 3.0.0? HOT 2
- Required node version HOT 5
- Export onloadCSS
- CSS is being loaded twice HOT 3
- loadCSS not helping with render-blocking content
- Why do I sometimes get a recommendation in google pagespeed 'Reduce unused CSS' ? HOT 1
- Wouldn't loading css asynchronously cause FOUC? HOT 1
- Calling loadCSS from a TypeScript Vite application throws Uncaught TypeError: Cannot read properties of undefined (reading 'createElement') at loadCSS (loadCSS.js:13:16)
- Help - loadCSS/Critical file load not working
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 loadcss.