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

Đang mở
#7,218 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
48/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
php
Lĩnh vực
performance

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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).

Ngôn ngữ chính
PHP
Star
31
Fork
7
Merge trung bình
3 giờ 40 phút
Pull request đã merge (30 ngày)
813

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của Automattic/blocks-engine

Tất cả issue của Automattic/blocks-engine

Issue tương tự

Thêm issue về PHP

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.