[wp-trac] [WordPress Trac] #50328: Enqueue script and style assets only for blocks present on the page
WordPress Trac
noreply at wordpress.org
Fri Jul 3 01:30:42 UTC 2020
#50328: Enqueue script and style assets only for blocks present on the page
-------------------------+-------------------------
Reporter: aduth | Owner: gziolo
Type: enhancement | Status: assigned
Priority: normal | Milestone: 5.5
Component: Editor | Version:
Severity: normal | Resolution:
Keywords: | Focuses: javascript
-------------------------+-------------------------
Comment (by westonruter):
Replying to [comment:7 gziolo]:
> it all edge cases makes me wonder whether the initial approach proposed
by aduth wouldn't be more reliable in the majority of cases.
Are you referring to enqueueing the scripts/styles when the blocks are
rendered and then printing the scripts/styles in the footer? The risk
there is with [https://en.wikipedia.org/wiki/Flash_of_unstyled_content
FOUC]. But FOUC is probably better than adding a lot of assets which are
never used on the page. Nevertheless, FOUC can negatively impact
[https://web.dev/vitals/ Core Web Vitals], in particular
[https://web.dev/lcp/ largest contentful paint] (LCP) and
[https://web.dev/cls/ cumulative layout shift] (CLS).
--
Ticket URL: <https://core.trac.wordpress.org/ticket/50328#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list