Skip to content
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: rename 'css_var' option property to 'convert_vars_to_classnames' #42113

Merged
merged 2 commits into from
Jul 4, 2022

Conversation

ramonjd
Copy link
Member

@ramonjd ramonjd commented Jul 4, 2022

What?

This PR renames css_var to convert_vars_to_classnames.

Why?

The style engine returns classnames in its output.

In the case of block supports, classnames are generated from var:preset|{$css_property}|{$slug} values and, in the resulting CSS, we skip generating var(--wp--preset--{$css_property}--{$slug}).

At the moment we have a css_var option to tell the style engine to compile CSS var values in CSS declarations.

This should, however, be the default.

Block supports are the only places where we need to skip CSS vars and return corresponding classnames.

So instead, block supports can use the flag convert_vars_to_classnames instead of everywhere else using css_var, which had a confusing name anyway.

How?

Renaming css_var to convert_vars_to_classnames

Testing Instructions

Run the tests!

npm run test-unit-php
npm run test-unit-php /var/www/html/wp-content/plugins/gutenberg/packages/style-engine/phpunit/class-wp-style-engine-test.php

@ramonjd ramonjd added [Type] Task Issues or PRs that have been broken down into an individual action to take [Type] Experimental Experimental feature or API. [Package] Style Engine /packages/style-engine labels Jul 4, 2022
@ramonjd ramonjd self-assigned this Jul 4, 2022
Copy link
Contributor

@glendaviesnz glendaviesnz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, that makes more sense - thanks for this tidy up - tests well for me, happy to 🚢 once that failing test is sorted.

@ramonjd ramonjd merged commit f751382 into trunk Jul 4, 2022
@ramonjd ramonjd deleted the update/style-engine-rename-css-vars-option branch July 4, 2022 08:26
@github-actions github-actions bot added this to the Gutenberg 13.7 milestone Jul 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Style Engine /packages/style-engine [Type] Experimental Experimental feature or API. [Type] Task Issues or PRs that have been broken down into an individual action to take
Projects
Status: 🏆 Done
Development

Successfully merging this pull request may close these issues.

None yet

2 participants