From 111fe6ee970bbf36d83a6129e419f534410b31c2 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers <359867+desrosj@users.noreply.github.com> Date: Thu, 19 Mar 2026 21:08:28 -0400 Subject: [PATCH 1/4] Remove unnecessary `trailingslashit()`. --- src/wp-includes/class-wp-icons-registry.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/wp-includes/class-wp-icons-registry.php b/src/wp-includes/class-wp-icons-registry.php index 2e306bec77e53..0d56aed246063 100644 --- a/src/wp-includes/class-wp-icons-registry.php +++ b/src/wp-includes/class-wp-icons-registry.php @@ -42,7 +42,6 @@ class WP_Icons_Registry { */ protected function __construct() { $icons_directory = __DIR__ . '/icons/'; - $icons_directory = trailingslashit( $icons_directory ); $manifest_path = $icons_directory . 'manifest.php'; if ( ! is_readable( $manifest_path ) ) { From b6e8d5a9b9f551c06bd5b06b256fb7ccf5943034 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers <359867+desrosj@users.noreply.github.com> Date: Thu, 19 Mar 2026 21:29:30 -0400 Subject: [PATCH 2/4] Move Icon Library files to more appropriate homes This updates the build script to: - copy the icon library SVG files to `wp-includes/images/icon-library` instead of `wp-includes/icons` - Moves the `manifest.php` file to the `wp-includes/assets/` directory. - Gives the `manifest.php` file a more specific name: `icon-library-manifest.php` - Remove `gutenberg-` from the corresponding `grunt copy` tasks. --- .gitignore | 2 +- Gruntfile.js | 49 ++++++++++++--------- src/wp-includes/class-wp-icons-registry.php | 4 +- 3 files changed, 31 insertions(+), 24 deletions(-) diff --git a/.gitignore b/.gitignore index 81058cebf0f6d..fa5edc8a9d7f8 100644 --- a/.gitignore +++ b/.gitignore @@ -39,7 +39,7 @@ wp-tests-config.php /src/wp-includes/css/*-rtl.css /src/wp-includes/blocks/* !/src/wp-includes/blocks/index.php -/src/wp-includes/icons +/src/wp-includes/images/icon-library /src/wp-includes/build /src/wp-includes/theme.json /packagehash.txt diff --git a/Gruntfile.js b/Gruntfile.js index 821046a4c86c6..418001b76dad3 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -55,6 +55,8 @@ module.exports = function(grunt) { 'wp-includes/css/dist', 'wp-includes/blocks/**/*', '!wp-includes/blocks/index.php', + 'wp-includes/images/icon-library', + // Old location kept temporarily to ensure they are cleaned up. 'wp-includes/icons', ], @@ -682,31 +684,35 @@ module.exports = function(grunt) { }, ], }, - 'gutenberg-icons': { + 'icon-library-images': { + files: [ { + expand: true, + cwd: 'gutenberg/packages/icons/src/library', + src: '*.svg', + dest: WORKING_DIR + 'wp-includes/images/icon-library', + } ], + }, + 'icon-library-manifest': { options: { - process: function( content, srcpath ) { - // Remove the 'gutenberg' text domain from _x() calls in manifest.php. - if ( path.basename( srcpath ) === 'manifest.php' ) { - return content.replace( + process: function( content ) { + return content + // Remove the 'gutenberg' text domain from _x() calls. + .replace( /_x\(\s*([^,]+),\s*([^,]+),\s*['"]gutenberg['"]\s*\)/g, '_x( $1, $2 )' + ) + // Strip the 'library/' prefix from filePath values so they + // resolve correctly relative to wp-includes/images/icon-library/. + .replace( + /'filePath' => 'library\//g, + "'filePath' => '" ); - } - return content; } }, - files: [ - { - src: 'gutenberg/packages/icons/src/manifest.php', - dest: WORKING_DIR + 'wp-includes/icons/manifest.php', - }, - { - expand: true, - cwd: 'gutenberg/packages/icons/src/library', - src: '*.svg', - dest: WORKING_DIR + 'wp-includes/icons/library/', - }, - ], + files: [ { + src: 'gutenberg/packages/icons/src/manifest.php', + dest: WORKING_DIR + 'wp-includes/assets/icon-library-manifest.php', + } ], }, }, sass: { @@ -2059,12 +2065,13 @@ module.exports = function(grunt) { 'copy:gutenberg-modules', 'copy:gutenberg-styles', 'copy:gutenberg-theme-json', - 'copy:gutenberg-icons', + 'copy:icon-library-images', + 'copy:icon-library-manifest', ] ); grunt.registerTask( 'build', function() { var done = this.async(); - + grunt.util.spawn( { grunt: true, args: [ 'clean', '--dev' ], diff --git a/src/wp-includes/class-wp-icons-registry.php b/src/wp-includes/class-wp-icons-registry.php index 0d56aed246063..6da434aa1602f 100644 --- a/src/wp-includes/class-wp-icons-registry.php +++ b/src/wp-includes/class-wp-icons-registry.php @@ -41,8 +41,8 @@ class WP_Icons_Registry { * registry is loaded with those icons listed in the manifest. */ protected function __construct() { - $icons_directory = __DIR__ . '/icons/'; - $manifest_path = $icons_directory . 'manifest.php'; + $icons_directory = __DIR__ . '/images/icon-library/'; + $manifest_path = __DIR__ . '/assets/icon-library-manifest.php'; if ( ! is_readable( $manifest_path ) ) { wp_trigger_error( From 50621c89394555dd32af077de70c8a87cd02b67c Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers <359867+desrosj@users.noreply.github.com> Date: Thu, 19 Mar 2026 21:50:35 -0400 Subject: [PATCH 3/4] Fix linting error. --- Gruntfile.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gruntfile.js b/Gruntfile.js index 418001b76dad3..4f3c2740c8806 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -705,7 +705,7 @@ module.exports = function(grunt) { // resolve correctly relative to wp-includes/images/icon-library/. .replace( /'filePath' => 'library\//g, - "'filePath' => '" + '\'filePath\' => \'' ); } }, From b617bf8055225d2e7cb6b06e50d2d26696860734 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers <359867+desrosj@users.noreply.github.com> Date: Thu, 19 Mar 2026 22:54:03 -0400 Subject: [PATCH 4/4] Change file reference in docblock. --- .../rest-api/endpoints/class-wp-rest-icons-controller.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-icons-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-icons-controller.php index 03b2f8e6aef5e..42e726872d368 100644 --- a/src/wp-includes/rest-api/endpoints/class-wp-rest-icons-controller.php +++ b/src/wp-includes/rest-api/endpoints/class-wp-rest-icons-controller.php @@ -11,8 +11,8 @@ /** * Controller which provides a REST endpoint for the editor to read registered * icons. For the time being, only core icons are available, which are defined - * in a single manifest file (wp-includes/icons/manifest.php). Icons are - * comprised of their SVG source, a name and a translatable label. + * in a single manifest file (wp-includes/assets/icon-library-manifest.php). + * Icons are comprised of their SVG source, a name and a translatable label. * * @since 7.0.0 *