Skip to content

ACF Blocks v2.11.0

Choose a tag to compare

@github-actions github-actions released this 20 Aug 10:03
· 1 commit to main since this release

What's Changed

Fixed

  • Inlined block stylesheets shipped unminified source. acf_blocks_minify_loader_src() only runs when a sheet is printed as a <link>. Styles registered from block.json also carry path data, and wp_maybe_inline_styles() reads that file straight off disk and prints its bytes into the page without the URL ever reaching style_loader_src — so every page rendering one of those blocks carried the readable source. It hit the four blocks whose block.json declares style as an array (Callout, Feature Grid, Post Display, Table of Contents); a string style is pre-registered by acf_blocks_register_styles() under the handle WordPress would have generated, so core bails before attaching path. acf_blocks_minify_registered_styles() now rewrites both src and path on plugin-owned registrations before the inline pass. Rewriting the registration rather than the printed tag keeps the inlining, so pages still avoid the extra request and just carry less of it — measured on a published Table of Contents post, 2,279 inlined bytes down to 1,494.
  • ACF blocks now keep their baseline rhythm in the block editor. acf_blocks_register_layout_styles() attaches tokens.css and block-layout.css with wp_enqueue_block_style(), which only fires when a block renders on the front end — the editor canvas never received them. A heading following a Table of Contents block sat flush against it while editing and had 1.5rem of air once published. The sheets are now also enqueued on enqueue_block_assets in admin, the hook WordPress injects into the canvas document. Front-end delivery still goes through wp_enqueue_block_style(), so pages only pay for the sheets when a block is actually present.
  • block-layout.css matches the editor's markup. The front end renders the block element itself carrying .acf-block, while the editor wraps the same output in .wp-block and puts acf-block-component / acf-block-<name> on the wrapper — so .acf-block matched nothing inside the canvas even once the sheet loaded. The rule now carries a second selector for the wrapper. The two cannot match the same element, so the margin is never doubled. That second selector deliberately does not use :where(): the block editor sets its own margins on .wp-block elements, so a zero-specificity rule loses to them. Measured on a Table of Contents block followed by a heading — 0px with :where(), 24px without, against 24px on the published page.

Commits

  • 2.11.0: serve minified CSS for inlined block stylesheets (ae06e79)

Stats

  • Commits: 1
  • Changes: 7 files changed, 212 insertions(+), 4 deletions(-)

Plugin Info

  • Blocks included: 29
  • Requires WordPress: 6.0+
  • Requires PHP: 7.4+
  • Requires: ACF Pro 6.0+ or Secure Custom Fields

Installation

  1. Download acf-blocks-plugin-*.zip from the assets below
  2. Go to Plugins → Add New → Upload Plugin in WordPress admin
  3. Upload the zip file and activate