Plugin vs. theme component

Continuing the discussion from Thumbs up, twice:

Sorry, I didn’t try search — I’m a horrible person.

But if out there is a plugin and a theme component and those do (almost) same thing what is the most important difference between those two?

A plugin needs rebuilding, of course, but is there some other reasons why other is better choice than other?

First, the Reactions plugin and the change-like-icon theme component do not (almost) do the same thing.

Yes, you can use the Reactions plugin to change the like icon but its main purpose is to offer multiple possible reactions, so its functionality is much broader than only a cosmetic change.

A plugin can do everything a theme component can do, but a theme component can not do everything a plugin can do.

A plugin consists of server-side and client-side code,
and a theme component consists only on client-side code and has to rely on existing server-side code.

5 Likes

That’s true between those. I didn’t think that much, being reactive was my middle name today :joy:

So — in real world plugins and components do never same things and then the only reason to use this or that is what it serves?

1 Like

That is so abstractly worded that the answer is probably ‘yeah’.

5 Likes

That’s true, but it seemed from another topic that all he wanted to do was to do what the theme component does and just have a single :+1: rather than a :heart: .

If you need changes made to Rails (like you need to store or retrieve different data from the database) then you need a plugin.

If you’re changing only the front end (Ember and CSS) then a theme component will do the trick. (A while back, the difference was more nuanced.)

If what you’re doing can be accomplished in Ember only, then a theme component is easier to install since it doesn’t require rebuilding the docker image.

3 Likes

I took this to its logical conclusion with Topic List Previews Theme Component.

This used to be a plugin, until some of its functionality was adopted by Core (thumbnails) at which point I was able to put most of its functionality into a Theme Component to give it a bigger audience and an easier install.

I’ve added and kept some advanced features that require changes to the back end in a complimentary plugin.

Another good example here is Guest Gate Theme Component. This started life as a plugin, but turns out you don’t need it to be, so was reborn as a new Theme Component (plugins predate Theme Components).

There are probably still one or two plugins that could be converted into a Theme Component (I can think of one of the top of my head) … and there are likely to be more candidates as more functionality is added to the core API …

3 Likes

This plugin:

Was made as a theme component later as well:

2 Likes