WordPress.org

Make WordPress Core

Opened 8 months ago

Closed 6 months ago

Last modified 5 months ago

#52620 closed enhancement (fixed)

Add `path` data to block stylesheets to allow improving their loading method

Reported by: aristath Owned by: gziolo
Milestone: 5.8 Priority: normal
Severity: normal Version:
Component: General Keywords:
Focuses: performance Cc:

Description

In Gutenberg we recently merged PR https://github.com/WordPress/gutenberg/pull/28358 to improve loading stylesheets for blocks.
As noted in comment https://github.com/WordPress/gutenberg/pull/28358#commitcomment-46742341 we need to also tweak the register_block_style_handle function to allow 3rd-party blocks to take advantage of these improvements.

Change History (6)

#1 @SergeyBiryukov
8 months ago

  • Milestone changed from Awaiting Review to 5.8

#2 @prbot
8 months ago

aristath commented on PR #1035:

Nice, thank you for starting this PR. I think we should extend existing unit tests to cover this new style data.

Done in https://github.com/WordPress/wordpress-develop/pull/1035/commits/70f57cf5f0bc0548e08a280325774e29677220be 👍

#3 @prbot
8 months ago

gziolo commented on PR #1035:

Good, it should be fine to land as soon as the release process for WP 5.7 is finished.

#4 @gziolo
6 months ago

  • Owner set to gziolo
  • Resolution set to fixed
  • Status changed from new to closed

In 50836:

Editor: Enqueue script and style assets only for blocks present on the page

Adds styles for individual core blocks to make it possible to render only styles for those blocks that are rendered on the page (frontend). This is optinal functionality for start that can be controlled with the new separate_core_block_assets filter.

In addition to that, styles can be inlined when path is passed when registering an individual styles. This functionality can be changed with the new styles_inline_size_limit filter. The maximum size of inlined styles in bytes defaults to 20 000.

Props aristath, aduth, westonruter, mcsf.
Fixes #50328, #52620.

#5 @SergeyBiryukov
6 months ago

In 50838:

Editor: Some documentation and test improvements for loading separate assets for core blocks:

  • Move should_load_separate_core_block_assets() to a more appropriate place.
  • Update DocBlocks and inline comments per the documentation standards.
  • Document the $wp_styles global in wp_maybe_inline_styles().
  • List the expected result first in unit test assertions.
  • Remove a duplicate unit test.
  • Add missing @covers tags.

Follow-up to [50836], [50837].

See #50328, #52620, #53180.

#6 @johnbillion
5 months ago

In 51065:

Editor: Correct some docblocks added in [50836].

See #50328, #52620.

Note: See TracTickets for help on using tickets.