Open cawa-93 opened 1 year ago
I have been able to confirm and would similarly expect this styling only to render when a Button block is added to the page. Added some labels to get additional eyes on this issue.
cc @glendaviesnz or @Mamaduka, who might be able to provide technical feedback.
@aristath or @carolinan should have more details for the block CSS feature since they worked on the implementation.
Hmmm the per-block custom-css is currently getting added to the global custom-css. In order to make these styles render only when a block exists on the page (as they should), they'll have to be decoupled from there, and attached to the block-styles instead. It's doable, but it will require some code restructuring 🤔
Thank you, Ari! I belive that would be an excellent enhancement for the next major WP release.
Can we update this before I continue on https://github.com/WordPress/gutenberg/pull/49396
Can we update this before I continue on https://github.com/WordPress/gutenberg/pull/49396
Not necessary, it can be done after that PR without side-effects 👍
Description
If I add some custom css for specific block I expect that this css will be included to page only if that block also included. But currently, it seems block-specific css always included, no mater is actually block itself used on page or not.
Step-by-step reproduction instructions
templates/index.html
andtheme.json
like so:index.html
template..wp-block-button .wp-block-button__link{color: red}
but I expect expected it not to beScreenshots, screen recording, code snippet
No response
Environment info
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes