When to switch themes/plugins to `.gjs`?

I’d like to bump this as I’m trying to figure out the best way to handle my components. Right now I see two options that both have major downsides: I could create a registry per theme component that renders blocks, but it sort of defeats the whole modular purpose. Or add one globally through a plugin, but then my components become dependent on that plugin being installed.

So it seems like having a global block registration API in core would really help. Something that theme components could use to invoke block rendering and also to register new blocks.

I love working with the block approach because it lets me split concerns between app layout and component content. The block component just handles rendering its content, then gets rendered by another component in the app. I can drop all the route and outlet logic from the block component, and I can easily reuse the same block multiple times on a layout and even throughout the app.

I find it makes everything leaner and more reusable and it’s overall an elegant approach. Having solid support for this pattern in Discourse would be great.

3 Likes