Replies: 1 comment 1 reply
-
|
@bakura10 I was thinking of almost the same thing this weekend until a teammate pointed this thread out. Thanks for sharing!
👍🏻 IMO this is key for progress of reusable components across lots of projects. All configurations for a component should be available to a developer working with the code, and they should be able to cherry pick which of those configurations they want to expose in the editor. It's currently possible to do this with snippets via params as the developer configuration interface and then cherry picking from those params and setting their values to global, section, or block settings.
💯 Yessss the schema json is already well structured to provide all the documentation needed for a component. Pair that with moving the schema to the top of the file so that the file starts with variable declarations and you have a nice summary of what variables the components is working with. Also super easy to pull this JSON with a script and automatically generate some nice docs with it.
I can't help but feel a simpler future here would be to make blocks capable of doing everything you would otherwise be doing with snippets. Why can your subheader snippets not become blocks? With the use of presets you could make sure their initial state is rendered the same way they currently do with snippets (especially if we get hidden settings ^^) |
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I like to think blocks as "components". They should be re-usable but also included in the rest of the code.
For instance, in our next theme we have a
subheadingthat is styled in a very specific way, and require different configuration. While trying to migrate this to theme blocks, I therefore created a new theme block with the parameter:The reason I need to have a snippet is because I have some other sections that also require showing a subheading, but where the subheading is not rendered inside the context of the block.
I happen to actually have this on a lot of different elements, which ends up having each component duplicated twice: once as a block, and once as a snippet, where the block just include the snippet.
I would like to actually be able to also render an app block, and passing it parameters that would be transformed as options:
This way, the snippet content can be integrated into the block.
If a user try to pass an option that does not exist in the schema, then it should simply be ignored:
It might be useful though to have extra options to configure how a block will render, without exposing it visually to the theme editor. For instance, a
balance_textoption. We might want to use it when rendering the block, but not show it in the editor:We could eventually think of "hidden" settings:
I can see this as a great way to actually self-document those blocks. Until now, all of my snippets included a doc with the supported parameters that a dev can use:
But it is very easy to forgot adding a documentation when we add/remove option, so having this move to the list of settings make it more explicit.
Beta Was this translation helpful? Give feedback.
All reactions