Make WordPress Core

Changeset 62077


Ignore:
Timestamp:
03/20/2026 03:39:18 PM (8 days ago)
Author:
desrosj
Message:

Build/Test Tools: Move icon library SVG files to wp-includes/images.

This makes several changes to the build script to place the icon library files into more appropriate locations.

  • The icon library SVG files are now copied into the wp-includes/images/icon-library directory instead of wp-includes/icons.
  • The name of the manifest.php file has changed to icon-library-manifest.php and is now copied to wp-includes/assets.
  • An unnecessary trailingslashit() has been removed.
  • The gutenberg- prefix for the corresponding grunt copy tasks has been removed.

These values are merged into the script-loader-packages.php file during a build, so the original PHP files are not required.

Props mcsf, desrosj.
See #64393.

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/.gitignore

    r61800 r62077  
    4040/src/wp-includes/blocks/*
    4141!/src/wp-includes/blocks/index.php
    42 /src/wp-includes/icons
     42/src/wp-includes/images/icon-library
    4343/src/wp-includes/build
    4444/src/wp-includes/theme.json
  • trunk/Gruntfile.js

    r62071 r62077  
    5656            'wp-includes/blocks/**/*',
    5757            '!wp-includes/blocks/index.php',
     58            'wp-includes/images/icon-library',
     59            // Old location kept temporarily to ensure they are cleaned up.
    5860            'wp-includes/icons',
    5961        ],
     
    683685                ],
    684686            },
    685             'gutenberg-icons': {
     687            'icon-library-images': {
     688                files: [ {
     689                    expand: true,
     690                    cwd: 'gutenberg/packages/icons/src/library',
     691                    src: '*.svg',
     692                    dest: WORKING_DIR + 'wp-includes/images/icon-library',
     693                } ],
     694            },
     695            'icon-library-manifest': {
    686696                options: {
    687                     process: function( content, srcpath ) {
    688                         // Remove the 'gutenberg' text domain from _x() calls in manifest.php.
    689                         if ( path.basename( srcpath ) === 'manifest.php' ) {
    690                             return content.replace(
     697                    process: function( content ) {
     698                        return content
     699                            // Remove the 'gutenberg' text domain from _x() calls.
     700                            .replace(
    691701                                /_x\(\s*([^,]+),\s*([^,]+),\s*['"]gutenberg['"]\s*\)/g,
    692702                                '_x( $1, $2 )'
     703                            )
     704                            // Strip the 'library/' prefix from filePath values so they
     705                            // resolve correctly relative to wp-includes/images/icon-library/.
     706                            .replace(
     707                                /'filePath' => 'library\//g,
     708                                '\'filePath\' => \''
    693709                            );
    694                         }
    695                         return content;
    696710                    }
    697711                },
    698                 files: [
    699                     {
    700                         src: 'gutenberg/packages/icons/src/manifest.php',
    701                         dest: WORKING_DIR + 'wp-includes/icons/manifest.php',
    702                     },
    703                     {
    704                         expand: true,
    705                         cwd: 'gutenberg/packages/icons/src/library',
    706                         src: '*.svg',
    707                         dest: WORKING_DIR + 'wp-includes/icons/library/',
    708                     },
    709                 ],
     712                files: [ {
     713                    src: 'gutenberg/packages/icons/src/manifest.php',
     714                    dest: WORKING_DIR + 'wp-includes/assets/icon-library-manifest.php',
     715                } ],
    710716            },
    711717        },
     
    20602066        'copy:gutenberg-styles',
    20612067        'copy:gutenberg-theme-json',
    2062         'copy:gutenberg-icons',
     2068        'copy:icon-library-images',
     2069        'copy:icon-library-manifest',
    20632070    ] );
    20642071
  • trunk/src/wp-includes/class-wp-icons-registry.php

    r61748 r62077  
    4242     */
    4343    protected function __construct() {
    44         $icons_directory = __DIR__ . '/icons/';
    45         $icons_directory = trailingslashit( $icons_directory );
    46         $manifest_path   = $icons_directory . 'manifest.php';
     44        $icons_directory = __DIR__ . '/images/icon-library/';
     45        $manifest_path   = __DIR__ . '/assets/icon-library-manifest.php';
    4746
    4847        if ( ! is_readable( $manifest_path ) ) {
  • trunk/src/wp-includes/images

    • Property svn:ignore set to
      icon-library
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-icons-controller.php

    r61739 r62077  
    1212 * Controller which provides a REST endpoint for the editor to read registered
    1313 * icons. For the time being, only core icons are available, which are defined
    14  * in a single manifest file (wp-includes/icons/manifest.php). Icons are
    15  * comprised of their SVG source, a name and a translatable label.
     14 * in a single manifest file (wp-includes/assets/icon-library-manifest.php).
     15 * Icons are comprised of their SVG source, a name and a translatable label.
    1616 *
    1717 * @since 7.0.0
Note: See TracChangeset for help on using the changeset viewer.