Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin Proposal: Stylesheet Optimizer #1834

Open
westonruter opened this issue Jan 28, 2025 · 0 comments
Open

Plugin Proposal: Stylesheet Optimizer #1834

westonruter opened this issue Jan 28, 2025 · 0 comments
Labels
[Plugin] Optimization Detective Issues for the Optimization Detective plugin [Type] Plugin Proposal A new plugin proposal

Comments

@westonruter
Copy link
Member

Overview

  • Proposed plugin name: Stylesheet Optimizer
  • Proposed plugin slug: stylesheet-optimizer
  • Proposed plugin owner GitHub username(s): westonruter

About the plugin

Purpose

When using a classic theme, the stylesheets for blocks are enqueued on every page even when they are not used. Similarly, the main block-library stylesheet is also enqueued rather than enqueueing individual stylesheets for each block that is actually used on the page. This is all wasteful.

Scope

Enable the should_load_separate_core_block_assets filter by default, even for classic themes. Move all styles printed in wp_footer up to the HEAD in the original dependency order as if the filter had not been applied.

This wouldn't necessarily depend on Optimization Detective since there would be no need for URL Metrics. All that is needed is the output buffering filter that Optimization Detective utilizes, and possibly the use of the HTML Tag Processor (cf. #1546) for removing the footer styles and putting them in the HEAD.

Then again, a subsequent enhancement for this plugin could be to leverage URL Metrics to detect what the critical styles are, so a dependency on Optimization Detective may make sense.

Rationale

The idea for a plugin was raised in a support forum topic by guillermo77.

@westonruter westonruter added the [Type] Plugin Proposal A new plugin proposal label Jan 28, 2025
@github-project-automation github-project-automation bot moved this to Not Started/Backlog 📆 in WP Performance 2024 Jan 28, 2025
@westonruter westonruter added the [Plugin] Optimization Detective Issues for the Optimization Detective plugin label Jan 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Plugin] Optimization Detective Issues for the Optimization Detective plugin [Type] Plugin Proposal A new plugin proposal
Projects
Status: Not Started/Backlog 📆
Development

No branches or pull requests

1 participant