Repository navigation
Conversation
Design tools export an icon with their own defaults: a width/height pair, a literal fill="none", and the artboard's color on every shape. The library hoists that paint onto the root so an icon inherits currentColor, and validate-collection rejects exports that keep the editor's defaults. Add `npm run normalize-export` to make that translation, and document it as a step in the README. It refuses anything it cannot translate faithfully -- a dashed stroke, an inline style, a stroke width other than 1.5 -- because silently dropping one changes the drawing while leaving a file that builds. Running it on an already normalized file is a no-op; --check reports what would change without writing. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
🤖 PR meta 🤖🎉 PropsIf 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. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
Updated as activity occurs, without notifying anyone named here. Add the 📦 Bundle sizeSize Change: 0 B Total Size: 8.64 MB
⚡ PerformanceShow the resultsClient side metrics exclude the server response time. front-end-block-theme
front-end-classic-theme
media-processing
media-upload
post-editor
site-editor
🏁 Flaky testsSome tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information. a navigation superseded by the traversal discharges to idle in
|
|
I use this script constantly. Mind a review? @WordPress/gutenberg-design |
|
Sorry for the late reply. What do you think about running this script automatically on commit, e.g. via lint-staged? That way, even if a contributor forgets to run it, invalid icons are much less likely to slip into a PR. If you like the idea, I'd be happy to push it to this PR. |
|
I think that's a great idea, and you are most welcome to push any changes you like—or just create a new PR and I'll close this one in favour of yours. I want to note due to the age of this PR, we should just double-check that what it outputs is still what we want. In my testing it is, it puts the correct currentColor values and props on the SVG, so I'm just noting that is one part that needs a fresh review. Thank you! |
Co-authored-by: t-hamano <54422211+t-hamano@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011g9URwrK9Tye4Yh48WoaqB
Run normalize-export through lint-staged before the icons build, so an export a contributor forgets to normalize is rewritten at commit time, and one the script cannot translate stops the commit. Co-authored-by: t-hamano <54422211+t-hamano@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011g9URwrK9Tye4Yh48WoaqB
The script also runs on committed icons, not only fresh design-tool exports, and the new name matches the verb-target naming of the other scripts in lib/. Co-authored-by: t-hamano <54422211+t-hamano@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011g9URwrK9Tye4Yh48WoaqB
|
Since the changes are likely to be quite extensive, I am continuing the work in #86657. |
|
Thank you. I'm closing this in favour of #86657. |
What?
Related to #81274.
Design tools export an icon with their own defaults: a width/height pair, a literal fill="none", and the artboard's color on every shape. The library hoists that paint onto the root so an icon inherits currentColor, and validate-collection rejects exports that keep the editor's defaults.
Add
npm run normalize-exportto make that translation, and document it as a step in the README. It refuses anything it cannot translate faithfully -- a dashed stroke, an inline style, a stroke width other than 1.5 -- because silently dropping one changes the drawing while leaving a file that builds. Running it on an already normalized file is a no-op; --check reports what would change without writing.Why?
Honestly because this very script helped me redraw 300+ icons to be stroke-based.
Testing Instructions
Export a new SVG drawn in Figma, run this script on it, and see if it passes.
Use of AI Tools
Claude Opus 5.