Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#52620 closed enhancement (fixed)

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

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


In Gutenberg we recently merged PR to improve loading stylesheets for blocks.
As noted in comment 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
3 years ago

  • Milestone changed from Awaiting Review to 5.8

aristath commented on PR #1035:

3 years ago

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

Done in 👍

gziolo commented on PR #1035:

3 years ago

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

#4 @gziolo
3 years 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
3 years 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
3 years ago

In 51065:

Editor: Correct some docblocks added in [50836].

See #50328, #52620.

Note: See TracTickets for help on using tickets.