Discussion: Gutenberg Blocks and Global Stylesheet Loading Issue #69342
EthanVaz11
started this conversation in
Developer Experience
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
As a developer implementing Gutenberg Blocks on my WordPress site, I have encountered an issue regarding how stylesheets are loaded. Specifically, I noticed that stylesheets smaller than 20KB are correctly loaded only on pages where the block is rendered. However, stylesheets larger than 20KB are being loaded globally across all page. This contradicts the expected behavior where styles should only be loaded when the block is in use on a page.
Observations:
Stylesheet Greater Than 20KB:
Stylesheet Less than 20KB:
File Size Threshold Impact:
style-index.cssfile, which is loaded globally, even on pages where the block is not used.Contradiction with Expected Behavior:
The issue contradicts the resolution mentioned in this GitHub discussion, which states that Javascript and stylesheets should not be loaded on pages where blocks are not rendered. However, in practice, I am seeing styles being globally enqueued under certain conditions.
Questions:
Looking forward to insights and possible solutions from the community.
Beta Was this translation helpful? Give feedback.
All reactions