-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Style engine: allow CSS var output for fontSize and fontFamily and update docs #56528
Conversation
This pull request has changed or added PHP files. Please confirm whether these changes need to be synced to WordPress Core, and therefore featured in the next release of WordPress. If so, it is recommended to create a new Trac ticket and submit a pull request to the WordPress Core Github repository soon after this pull request is merged. If you're unsure, you can always ask for help in the #core-editor channel in WordPress Slack. Thank you! ❤️ View changed files❔ lib/load.php ❔ phpunit/style-engine/style-engine-test.php |
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.
Thanks for neatening this up! As I understand it, this change doesn't affect any existing block markup, as the Typography support currently uses convert_vars_to_classnames
with a value of true
, so we never see the inline styles for var-based styles.
With this PR applied, and by manually changing that line to false
, then the inline styles will be correctly output for server-rendered blocks:
(The rules themselves get overridden by their classname-based counterparts, since they use !important
rules, but that's also to be expected, and is more to do with what the consumer does with what gets returned by the style engine rather than an issue with the logic here).
All looks good to me! And I didn't run into any regressions with existing block markup.
Just left a few nits in the docs, apologies for the multiple ones about tabs vs spaces 😄
LGTM! ✨
packages/style-engine/docs/using-the-style-engine-with-block-supports.md
Outdated
Show resolved
Hide resolved
packages/style-engine/docs/using-the-style-engine-with-block-supports.md
Outdated
Show resolved
Hide resolved
packages/style-engine/docs/using-the-style-engine-with-block-supports.md
Outdated
Show resolved
Hide resolved
packages/style-engine/docs/using-the-style-engine-with-block-supports.md
Outdated
Show resolved
Hide resolved
Yes, I should have added that test step in the description. Thank you for being so thorough! I'll fix the formatting and 🚢 |
…lasses have loaded - Adding CSS var parsing capability to fontSize and fontFamily. The JS package does this, theme.json has these presets, why not the Style Engine? I think it wasn't a deliberate omission. - Updating docs in relation to CSS var names
Spelling fix Co-authored-by: Andrew Serong <14988353+andrewserong@users.noreply.github.com>
… necessarily reflect the views or positions of the author in relation to tabs vs spaces.
ba6761d
to
7a5198e
Compare
Adds CSS var parsing capability to fontSize and fontFamily
What?
This PR:
Why?
'convert_vars_to_classnames' => true,
Testing Instructions
/build
folder in your local dev environmentnpm run dev
There should be no build warnings and the site should work as per usual.
Ensure that there are no regressions in block supports styles. Here is some test code:
Example block code
Frontend output
Run the tests!
npm run test:unit:php:base -- --group style-engine