Pros/Cons of using Theme instead of Plugin for customization

I’ve noticed that for design customization, Themes are recommended to be used instead of Plugins. What are the benefits?

From development view I see Themes like too cumbersome. I need one more tool to be able to see code changes in realtime - Theme CLI console.

I also get that Themes can be user selectable (I don’t need that feature)…

What are the benefits of Themes over Plugins in production?

1 Like

My take:

  1. Discretion at runtime on installation instead of at build time with zero downtime.
  2. Easier to disable and remove
  3. Usable by hosted clients who don’t have access to the console.

But agree plugins are usually easier to navigate from a devs perspective imho.

4 Likes

With the addition of Splitting up theme Javascript into multiple files, you can effectively do everything a plugin can do with Ember via a theme.

So if you don’t need to create routes, modify serializers, or store custom data, you can likely accomplish your outcome with just a theme.

The biggest challenge we see with custom plugins from a support perspective is site outages. This is usually because the plugin patches into a Rails class or method in core that’s changed and the plugin hasn’t been updated to account for it yet. If something changes on the Ember side and thus breaks the theme or theme component, the site may not render correctly but it can be quickly disabled using /safe-mode.

I can see your point here. I’d also say that gem enables you to develop on your theme locally and sync it to any Discourse site you have an API key to, including theme-creator.discourse.org. You don’t even need a local dev environment set up if you have that one gem running.

10 Likes

Wow the replies here are golden I have very little to add here.

The only thing I think is important to add is that internally at Discourse we are making strides to break some plugins now into “plugin for backend” and “theme for frontend”. We are thinking about this “distribution” challenge when stuff is mixed like this.

Overall my incredibly strong recommendation is only fallback to creating plugins if you absolutely need plugins. When you need to amend the Ruby backend you have no choice. A plugin that only makes changes to frontend is strongly discouraged. It is harder to keep up to date and far less flexible when it comes to usage.

12 Likes