wordpress-develop/tests/phpunit/tests/blocks
Jonny Harris 30d6172eed Script Loader: Fix performance issues in wp_common_block_scripts_and_styles.
In [52069] the function `wp_common_block_scripts_and_styles` was changed load individual theme stylesheets, if the current theme supports block styles and loading separate core block assets. To do this, the function calls many expensive file operation functions, such as `glob`, `file_exists` and `file_get_contents`. This is wasteful, as these functions are loaded on every page request, even request that do not include blocks, like REST API calls. In [56044] all core block styles are registered in a single place. In `register_core_block_style_handles` calls `glob` to get all css styles in block directories. While registering style and editor styles, also register block theme styles, under a new style handle. Example `wp-block-avatar-theme`. If the current theme supports block styles, also request the block to enqueue the theme style on the front end. As these new stylesheets have a path attribute set, the function `wp_maybe_inline_styles` will automatically inline the styles for you. 

Props spacedmonkey, flixos90, oandregal, costdev, audrasjb, mukesh27.
Fixes #58560.

git-svn-id: https://develop.svn.wordpress.org/trunk@56064 602fd350-edb4-49c9-b593-d223f7449a82
2023-06-27 11:26:12 +00:00
..
context.php Tests: Second pass at merging file-level and class-level DocBlocks in various unit test files. 2023-03-03 14:42:42 +00:00
editor.php Editor: rename reusable blocks to patterns. 2023-06-26 08:55:31 +00:00
getBlockTemplates.php Tests: Move the basic get_block_templates() test to the dedicated file. 2022-09-18 13:08:33 +00:00
register.php Editor: Register core block styles in one place. 2023-06-26 21:15:21 +00:00
registerCoreBlockStyleHandles.php Script Loader: Fix performance issues in wp_common_block_scripts_and_styles. 2023-06-27 11:26:12 +00:00
render.php Build/Tests Tools: Add unit tests for Gallery blocks. 2023-03-07 05:46:16 +00:00
renderCommentTemplate.php General: Use static on closures whenever $this is not used to avoid memory leaks. 2023-05-17 22:44:21 +00:00
renderReusable.php Tests: Second pass at merging file-level and class-level DocBlocks in various unit test files. 2023-03-03 14:42:42 +00:00
serialize.php Tests: Second pass at merging file-level and class-level DocBlocks in various unit test files. 2023-03-03 14:42:42 +00:00
supportedStyles.php Tests: Second pass at merging file-level and class-level DocBlocks in various unit test files. 2023-03-03 14:42:42 +00:00
wpBlock.php General: Use static on closures whenever $this is not used to avoid memory leaks. 2023-05-17 22:44:21 +00:00
wpBlockList.php Tests: Second pass at merging file-level and class-level DocBlocks in various unit test files. 2023-03-03 14:42:42 +00:00
wpBlockParser.php Tests: Second pass at merging file-level and class-level DocBlocks in various unit test files. 2023-03-03 14:42:42 +00:00
wpBlockType.php Tests: Second pass at merging file-level and class-level DocBlocks in various unit test files. 2023-03-03 14:42:42 +00:00
wpBlockTypeRegistry.php Tests: Second pass at merging file-level and class-level DocBlocks in various unit test files. 2023-03-03 14:42:42 +00:00