mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-03-31 02:34:38 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@56683 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"apiVersion": 2,
|
||||
"title": "Example Theme Block",
|
||||
"name": "block-theme/example-block",
|
||||
"description": "Custom block registered from within a theme",
|
||||
"editorScript": "file:./index.js",
|
||||
"style": "file:./style.css"
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
/* Test CSS file - RTL version */
|
||||
@@ -0,0 +1 @@
|
||||
/* Test CSS file */
|
||||
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
'dependencies' => array( 'wp-element', 'wp-blocks' ),
|
||||
'version' => 'test',
|
||||
);
|
||||
@@ -0,0 +1 @@
|
||||
/* Test JavaScript file. */
|
||||
@@ -0,0 +1 @@
|
||||
/* Test CSS file - RTL version */
|
||||
@@ -0,0 +1 @@
|
||||
/* Test CSS file */
|
||||
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
'dependencies' => array( 'wp-element', 'wp-blocks' ),
|
||||
'version' => 'test',
|
||||
);
|
||||
@@ -0,0 +1 @@
|
||||
/* Test JavaScript file. */
|
||||
Reference in New Issue
Block a user