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

Styles coming from __experimentalStyles are not enqueued in the post editor for themes without theme.json #46818

Open
oandregal opened this issue Dec 29, 2022 · 2 comments
Labels
Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Type] Bug An existing feature does not function as intended

Comments

@oandregal
Copy link
Member

oandregal commented Dec 29, 2022

Raised at #45731

Steps to reproduce:

  • Activate the TwentyTwenty theme.
  • Load the post editor.
  • Add a pullquote block.
  • Search for .editor-styles-wrapper .wp-block-pullquote.

The expected behavior is that there should be a style rule containing the font size and line height defined in the __experimentalStyle of the pullquote block embedded into the HTML document. However, that style rule is not present.

@oandregal oandregal added [Type] Bug An existing feature does not function as intended Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json labels Dec 29, 2022
@carolinan
Copy link
Contributor

carolinan commented Jan 23, 2023

This could be done with a conditional add_action( 'enqueue_block_editor_assets', 'global-styles' ); But it adds all the global styles.
Are we looking for a solution that only adds the styles from block.json __experimentalStyle?

@carolinan
Copy link
Contributor

carolinan commented Mar 14, 2023

Should the style not be added to classic.scss? It is loaded with https://developer.wordpress.org/reference/functions/wp_enqueue_classic_theme_styles/
In 6.2 it uses wp_theme_has_theme_json() :

function wp_enqueue_classic_theme_styles() {
	if ( ! wp_theme_has_theme_json() ) {
		$suffix = wp_scripts_get_suffix();
		wp_register_style( 'classic-theme-styles', '/' . WPINC . "/css/classic-themes$suffix.css" );
		wp_enqueue_style( 'classic-theme-styles' );
	}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

2 participants