WordPress / pattern-directory

The WordPress Block Pattern Directory
https://wordpress.org/patterns/
GNU General Public License v2.0
124 stars 34 forks source link

Question: How will patterns work with custom block styles? #79

Open carolinan opened 3 years ago

carolinan commented 3 years ago

In the patterns, the creator can add attributes to the blocks, as long as the block supports it (color, font size, padding etc, and soon, borders). But what if I want to create a pattern that needs CSS that can't be achieved with the block support? For example, box shadow, or positioning a block so that it overlaps (See for example Twenty Twenty-One). Or if the pattern needs to have a mobile and a desktop width style. Then I would need to add a CSS class to the block inside the pattern and register a custom block style.

If I was making a theme or plugin, that style would break when the plugin or theme was switched, only the content and the block markup would remain on the users install. How will this be solved with the patterns? Are the block patterns from the block pattern directory going to be accompanied with custom block styles that are saved to a global custom CSS field (think, the additional CSS field in the customizer)? Or something else? Registered when the pattern is placed? What would happen to that CSS if the block that has that class is deleted from the saved content?

Or are all block patterns going to be limited to the global styles?

StevenDufresne commented 3 years ago

Similar to https://github.com/WordPress/gutenberg/issues/31124

shaunandrews commented 3 years ago

Right now I'm working under the assumption that block patterns created and submitted to the Pattern Directory will not be able to provide any CSS.

ryelle commented 3 years ago

I think that's the right assumption - the only "style" options we should provide are the ones that have block support (global styles). I don't know offhand if there are any theme restrictions here, or how we should best set that up. Could a pattern use a style that a theme doesn't support? Do we need to declare style settings when initializing the editor? — things to think about as the editor is rebuilt here (#59).