Icons: Add a manifest containing icons metadata#74943
Merged
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
Related: Icons registration API and REST endpoint (#72215)
Related: Icon block (#71227)
Adds a file to the Icons package listing all the core icons along with their labels:
Why?
To allow core icons to have metadata. For now, it's only labels, but it could support categories, etc., in order to support the needs of the Icon block. This would allow
WP_Icons_Registry::register, a method currently proposed in #72215, to register icons based on that manifest and have all that metadata available.How?
packages/icons/src/manifest.phpfrom the available SVG icons and capitalised their labels automatically (and a manual correction for "WordPress" 😉).generate-libraryscript calledvalidate-manifest.php(whether natively or asnpm run env run cli php) in the middle of an NPM/Node call tree feels overkill.packages/icons/src/library/*.svgare listed in the manifestpackages/icons/src/library/*.svgAlternatives
manifest.json, but this would require more infrastructure work to make it translatable. Most likely, it would include patchingwp i18n'sJsonSchemaExtractor. This seems a bit too much.Testing Instructions
Run
npm run -w packages/icons build, then verify:index.tsand*.tsxunderpackages/icons/src/library/are correctly generatedVerify that errors are raised after tampering with / renaming SVG files or with entries in the manifest.