Skip to content

Icons: Only ship icon library SVGs listed in the manifest#12223

Closed
t-hamano wants to merge 5 commits into
WordPress:trunkfrom
t-hamano:65489-ignore-non-public-icons
Closed

Icons: Only ship icon library SVGs listed in the manifest#12223
t-hamano wants to merge 5 commits into
WordPress:trunkfrom
t-hamano:65489-ignore-non-public-icons

Conversation

@t-hamano

@t-hamano t-hamano commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

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/icons library (331 files) into wp-includes/images/icon-library. This shipped 243 unused SVG files to core that are never served.

This PR limits the copy:icon-library-images Grunt task to the SVGs referenced by the manifest, by parsing its filePath entries.

Trac ticket: https://core.trac.wordpress.org/ticket/65489

How to Test

### Remove all bundled files beforehand
rm -rf src/wp-includes/images/icon-library
### Copy icons
npx grunt copy:icon-library-images

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.

t-hamano and others added 2 commits June 19, 2026 11:20
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>
@github-actions

Copy link
Copy Markdown

Hi there! 👋

Thank you for your contribution to WordPress! 💖

It looks like this is your first pull request to wordpress-develop. Here are a few things to be aware of that may help you out!

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,
The WordPress Project

t-hamano and others added 2 commits June 19, 2026 11:31
…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>

@desrosj desrosj left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@github-actions

Copy link
Copy Markdown

Test using WordPress Playground

The 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

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

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>
@t-hamano t-hamano marked this pull request as ready for review June 19, 2026 02:46
@github-actions

Copy link
Copy Markdown

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 props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props wildworks, desrosj.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@desrosj

desrosj commented Jun 19, 2026

Copy link
Copy Markdown
Member

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 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 wordpress-develop demonstrating that it works.

@t-hamano

Copy link
Copy Markdown
Contributor Author

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.

Thank you, that approach seems better. Let's close this PR.

@t-hamano t-hamano closed this Jun 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants