-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Lodash: Remove completely from @wordpress/style-engine
package
#51726
Conversation
Size Change: +397 B (0%) Total Size: 1.43 MB
ℹ️ View Unchanged
|
Flaky tests detected in df988f2465530105233f8165916f4daed6f1bcc9. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5340321623
|
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.
Changes look good to me and test well for the most part... I did find that links within paragraph blocks weren't registering custom colors for their default state. They pick up hover-state color and other changes with no problem, the default color just seemed stuck.
Other links like those generated for archives, login, comments, etc. all picked up any styles I threw at them with no problem, so it's not that the color isn't saving. Could be fluke on my end, curious if anyone else sees the same results.
Thanks for testing so thoroughly, @chad1008! I wonder if this is something you can reproduce on trunk too? |
@tyxla Thank you for this. Tests well for me. 🙇 Hope you don't mind, but I threw in a few extra tests for the kebabCase on presets.
I would be interested to know how to reproduce. I tried and I couldn't. |
By the way... e2e fails are unrelated |
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.
Tentative approval in the meantime 🍺
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.
Re-ran some tests from yesterday and seeing the same... it works great in the actual site editor, the issue I found was:
- Create post, add paragraph with a link.
- Publish post and view on front end. Note link color.
- Launch site editor and change link styles, specifically colors.
- Refresh front end view of the test post.
In my tests, all theme-generated links look great. The in-content link seems to register every style I tested except for the main color... hover color gets picked up but the default state of the link maintains the theme/preset color.
All of that said - I can reproduce it on trunk, sorry for not thinking to check that yesterday. Whether it's a fluke on my end or something else, it definitely doesn't look like it's related to this PR, so adding my approval as well 👍
df988f2
to
e7c6e88
Compare
…dPress#51726) * Style Engine: Add change-case dependency * Style Engine: Migrate kebabCase in compileCSS() * Style Engine: Migrate kebabCase in getCSSVarFromStyleValue * Style Engine: Refactor away from _.get() * Style Engine: Remove Lodash dependency * Added a few more unit tests for getCSSVarFromStyleValue() --------- Co-authored-by: ramon <ramonjd@gmail.com>
What?
This PR refactors the
@wordpress/style-engine
package away from Lodash completely. There are just a few usages of_.get()
and_.kebabCase()
.Why?
Lodash is known to unnecessarily inflate the bundle size of packages, and in most cases, it can be replaced with native language functionality. See these for more information and rationale:
@wordpress/api-fetch
package haslodash
as a dependency #39495How?
_.get()
.paramCase
fromchange-case
instead ofkebabCase
, which we've already been utilizing across the repository.Testing Instructions