Icons: Only ship icon library SVGs listed in the manifest#12223
Icons: Only ship icon library SVGs listed in the manifest#12223t-hamano wants to merge 5 commits into
Conversation
The `icon-library-images` copy task copied every SVG from the `@wordpress/icons` library (331 files), but the core icon registry only loads the icons listed in `icon-library-manifest.php` (88 files). This shipped 243 unused SVG files to core. Limit the copy to the SVGs referenced by the manifest by parsing its `filePath` entries, and throw if the manifest is missing so the build fails loudly instead of silently copying nothing. Co-Authored-By: Claude <noreply@anthropic.com>
The core icon registry only loads the icons listed in `icon-library-manifest.php` (88 icons), but the full `@wordpress/icons` library (331 SVG files) had been copied into core, leaving 243 unused SVG files shipped but never served. Remove those unused SVG files to match the manifest, complementing the build-script fix that limits the copy to manifest-listed icons. Co-Authored-By: Claude <noreply@anthropic.com>
|
Hi there! 👋 Thank you for your contribution to WordPress! 💖 It looks like this is your first pull request to No one monitors this repository for new pull requests. Pull requests must be attached to a Trac ticket to be considered for inclusion in WordPress Core. To attach a pull request to a Trac ticket, please include the ticket's full URL in your pull request description. Pull requests are never merged on GitHub. The WordPress codebase continues to be managed through the SVN repository that this GitHub repository mirrors. Please feel free to open pull requests to work on any contribution you are making. More information about how GitHub pull requests can be used to contribute to WordPress can be found in the Core Handbook. Please include automated tests. Including tests in your pull request is one way to help your patch be considered faster. To learn about WordPress' test suites, visit the Automated Testing page in the handbook. If you have not had a chance, please review the Contribute with Code page in the WordPress Core Handbook. The Developer Hub also documents the various coding standards that are followed:
Thank you, |
# Conflicts: # Gruntfile.js
…g task loading. Calling getIconLibraryManifestFiles() while building the Grunt config threw when the Gutenberg artifacts were absent, which broke loading the Gruntfile for every task, including unrelated ones such as `jshint`. Resolve the copy source through a `get src()` getter instead, mirroring the existing `clean.gutenberg` pattern. The manifest is now only read when the icon copy task actually runs, so a missing manifest fails only that task while still failing loudly during a build. Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
I haven't tested yet, but a quick glance this seems reasonable and should work.
However, I think I'd like to try an approach similar to WordPress/gutenberg#76715 where SVG icons that are not marked "public": true do not get included in the Zip file at all. I am working on a PR for that approach to compare.
If Gutenberg is going to be the "source of truth" for the files being sourced from that repository, then only the files intended for wordpress-develop should actually be included when building in that context.
With over 200 non-public icons currently, it can help to keep the size of the zip file down and possibly avoid confusion.
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
The 243 icon SVG files dropped from `wp-includes/images/icon-library` shipped in WordPress 7.0, so they are not removed from existing installations on upgrade unless listed in `$_old_files`. Add the removed files to `$_old_files` under a new 7.1 section so they are cleaned up when upgrading from 7.0. Co-Authored-By: Claude <noreply@anthropic.com>
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
I still need to add proper PR descriptions, but WordPress/gutenberg#79338 is a rough idea of what this could look like being handled by WordPress/gutenberg. #12224 is the PR for |
Thank you, that approach seems better. Let's close this PR. |
The core icon registry only loads the icons listed in
icon-library-manifest.php(88 icons), but the build copied every SVG from the@wordpress/iconslibrary (331 files) intowp-includes/images/icon-library. This shipped 243 unused SVG files to core that are never served.This PR limits the
copy:icon-library-imagesGrunt task to the SVGs referenced by the manifest, by parsing itsfilePathentries.Trac ticket: https://core.trac.wordpress.org/ticket/65489
How to Test
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 4.8
Used for: Investigating the manifest/SVG mismatch, implementing the Gruntfile change, and regenerating the icon set. All changes were reviewed and verified by me.