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

Consider allowing themes to opt in to wp-block-styles via theme.json #37255

Closed
kjellr opened this issue Dec 9, 2021 · 5 comments
Closed

Consider allowing themes to opt in to wp-block-styles via theme.json #37255

kjellr opened this issue Dec 9, 2021 · 5 comments
Labels
[Feature] Themes Questions or issues with incorporating or styling blocks in a theme. [Type] Enhancement A suggestion for improvement.

Comments

@kjellr
Copy link
Contributor

kjellr commented Dec 9, 2021

wp-block-styles was considered and removed from #35593, as per @jasmussen's comment here.

This seems ok to omit by default, but I do think it would be helpful for themes to have the option of using theme.json to opt into this feature in general. Currently, they must do so via add_theme_support(). Currently, this is the only theme support call that Twenty Twenty-Two needs to make, and it would be great to migrate that over to theme.json.

@kjellr kjellr added [Type] Enhancement A suggestion for improvement. [Feature] Themes Questions or issues with incorporating or styling blocks in a theme. labels Dec 9, 2021
@zaguiini
Copy link
Member

zaguiini commented Dec 9, 2021

It would be awesome if Gutenberg by itself figured out which styles it needs based on block usage and loaded them on demand.

Example: I'm using the Image block. It makes sense to include the Image styles, while still not needing to load all the other styles.

@chthonic-ds
Copy link
Contributor

@zaguiini this has been possible since WP 5.8, more info here: https://make.wordpress.org/core/2021/07/01/block-styles-loading-enhancements-in-wordpress-5-8/. It's still required for a theme to opt in as of WP 5.9beta2 but #35593 (comment) suggests it will eventually be enabled by default.

@scruffian
Copy link
Contributor

Fixed by #40097

@scruffian
Copy link
Contributor

After a chat with @mtias we decided that this isn't the right approach. Instead we should move this CSS to Global Styles, and then build a mechanism to disable the core theme.json file:

#33977
#40181

This would render the wp-block-styles theme support obsolete.

@mtias
Copy link
Member

mtias commented Apr 9, 2022

wp.block-styles predates many of the block attribute tools and as such is a very opaque system. In time, things we expressed in the stylesheet should become part of the theme.json toolset (styling captions as elements.caption, specifying default views for blocks like Quote, etc). At that point an extra stylesheet is unnecessary and inconvenient, and absorbing its properties into attributes is much more flexible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Themes Questions or issues with incorporating or styling blocks in a theme. [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants