Editor-only stylesheets fragment into one file per producer (9 of 30 theme CSS files on a 4-route site)

Aperta
#7,218 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
php
Ambito
performance

Direzione di ricerca

Start with the onlyplants WORKFLOW notes mentioned in the issue and inspect EditorCanvasStylesheets::split, NavigationStyleProjector, and EvidenceRouteStylesheets::retire. Compare the two proposed approaches against the enqueue order and retirement behavior. Done means reducing editor-only stylesheet file count while preserving cascade order and correct retirement; the issue does not name a test or validation command.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Problem

On the onlyplants import (4 routes, SSI proportionate_assets reports css_file_count 30 against a cap of 20), 9 of the 30 theme CSS files are loaded only in the editor. Visitors never request them, but each one is a separate file on disk and a separate request in the editor canvas:

Generator Files Bytes each
EditorCanvasStylesheets::split: .editor-canvas.css extracts 6 242, 272, 280, 547, 1096, 1748
NavigationStyleProjector → editor-static-state-*, written per page as two sheets that differ only by source_role (engine-owned or not) 2 778, 1094
editor-static-state shared-chrome-* (global, engine-owned) 1 231

Four of the extracts are under 600 bytes, just above MIN_EXTRACT_BYTES = 200. The two per-page editor-static-state sheets share scope, placement (after-author) and target (editor), and are enqueued one after the other.

Expected

Editor-only rules that one route loads in one cascade run should arrive as one file, not one file per producer. Two options, either one rendering-neutral:

  • Concatenate adjacent editor-only sheets that have the same scopes, placement and media. Concatenating in enqueue order preserves the cascade. The source_role distinction only matters to EvidenceRouteStylesheets::retire, so it can live per rule run rather than per file.
  • Reconsider the 200-byte extract floor. It was tuned for visitor bytes, but every extract also counts against the theme's file budget.

Evidence

Baseline: SSI a606a335c + BE trunk 50c79c1bd94, full onlyplants capture. Inventory and measurements are in the import loop's onlyplants WORKFLOW notes. Related: #4563, #4589, #7205, Automattic/blocks-engine#7216 (the functions.php part of the same scorecard check).

Lingua principale
PHP
Stelle
31
Fork
7
Merge medio
3h 40m
PR unite (30g)
813

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Automattic/blocks-engine

Tutte le issue di Automattic/blocks-engine

Issue simili

Altre issue su PHP

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.