-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Build: Support watching SVG icons to generate TSX #72087
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Follow-up of #71878 As of #71878, the library of icons in the Icons package consists of plain SVG files, from which a build step generates TSX files and an index.ts. However, this generation only happened once upon invoking `npm run dev` (and `npm run build`). This commit adds support for watching changes to those SVG files and regenerating accordingly.
|
Size Change: -144 B (-0.01%) Total Size: 1.96 MB
ℹ️ View Unchanged
|
t-hamano
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
|
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 If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Co-authored-by: Aki Hamano <[email protected]>
|
Flaky tests detected in f11fa95. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/18281003284
|
What?
Follow-up of #71878
As of #71878, the library of icons in the Icons package consists of plain SVG files, from which a build step generates TSX files and an index.ts.
However, this generation only happened once upon invoking
npm run dev(andnpm run build). This pull request adds support for watching changes to those SVG files and regenerating accordingly.Why?
Better developer experience whenever an icon is being actively tweaked.
How?
bin/packages/):src/**/*.svgas a possible match for source filesbuildSVG) specifically for icons which calls the preexisting generation functionsTo do
Testing Instructions
npm run dev. Once it settles:packages/icons/src/library/*.svg. Ensure that the watcher-builder sees this change and generates the corresponding TSX file. Ensure that the icon has changed in the UI.packages/icons/src/library/*.svg. Ensure that the watcher-builder reports this as an error.git add, then restartdev) and ensure that a TSX file is now generated.npm run build. It should work just as described in Icons: Switch to SVG icons, autobuild React elements #71878.Screenshots or screencast
icons-watcher.mov