WordPress / WordPress/performance

Proposal: Just-In-Time Block CSS

Open
#2,076 7 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

[Plugin] Optimization Detective [Type] Enhancement Needs Discussion
Dominant language
PHP
Stars
461
Forks
165
Avg merge
11h 12m
Merged PRs (30d)
28

Description

Feature Description

For Block themes, WP modularizes and serves only the stylesheets needed for the blocks actually on the page, which is great! But it serves them all in the <head> tag, which is not as great, because all of them become render blocking even if their corresponding blocks are below-the-fold.

Would it be possible to modify the output of each CSS file to be enqueued just before the first instance of its relevant block? That way, the CSS for my social icons block in the footer doesn't have to be parsed before my hero cover block is rendered.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no files, tests, or entry points. Begin by locating how Block themes enqueue and output block stylesheets, then determine whether styles can be emitted before the first relevant block; done means a defined implementation approach with tests covering above- and below-the-fold blocks.

Written by the indexing model from the issue text.

Assessment

Tech stack
css, php, wordpress
Domain
frontend, performance
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.