Make WordPress Core

09/25/2023 05:47:27 PM (8 months ago)

Editor: Introduce get_block_asset_url Utility Function.

This commit introduces a valuable utility function, get_block_asset_url, designed to simplify the retrieval of block asset URLs, such as those for CSS and JavaScript files. This utility eliminates redundancy in both register_block_script_handle and register_block_style_handle. Additionally, get_block_asset_url incorporates an early exit mechanism to optimize performance.

This update includes comprehensive unit tests, covering various scenarios, including asset registration from core (wp-includes), themes, child themes, plugins, and mu-plugins.

Props spacedmonkey, joemcgill, flixos90, gziolo.
Fixes #58525.

1 added

Note: See TracChangeset for help on using the changeset viewer.