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

Add viewStyle property for block metadata #5531

Closed
wants to merge 4 commits into from

Conversation

gaambo
Copy link

@gaambo gaambo commented Oct 19, 2023

Adds a viewStyle property for block metadata to allow registering stylesheets/handles, that will only be enqueued on the frontend if a block is rendered (not in the backend). Similar to viewScript.
See trac ticket for more information.

Trac ticket: 59673


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

@gziolo gziolo mentioned this pull request Nov 3, 2023
58 tasks
@gziolo gziolo changed the title add viewStyle property for block metadata Add viewStyle property for block metadata Nov 3, 2023
Copy link
Member

@gziolo gziolo left a comment

Choose a reason for hiding this comment

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

Let’s plan to include it in the upcoming WP 6.5.0 release. I need to take a closer look, but so far everything looks good.

src/wp-includes/blocks.php Outdated Show resolved Hide resolved
src/wp-includes/class-wp-block-type.php Outdated Show resolved Hide resolved
src/wp-includes/class-wp-block-type.php Outdated Show resolved Hide resolved
Co-authored-by: Greg Ziółkowski <grzegorz@gziolo.pl>
Copy link

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • The Plugin and Theme Directories cannot be accessed within Playground.
  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

@gziolo
Copy link
Member

gziolo commented Jan 31, 2024

Committed with https://core.trac.wordpress.org/changeset/57493.

@gziolo gziolo closed this Jan 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants