Best Workflow for Maintaining Themes?

Hi all,

I wanted to ask what the recommended or best method of maintaining your edits/customizations on say an existing theme is?

I’d like as an example to make edits to @rewphus’s fantastic Material Design Stock Theme and I was wondering if it would be good to fork it, build on it and then try to sync from upstream?

I know in other forum software that doesn’t use Repos or Git concepts, you would be to install a copy of the theme and then install second copy as a child and only edit the child, so that when updates came in, you’d update the parent.

1 Like

You can essentially do the same thing: build your own theme component and add that as a child to your base theme (sourced from git). Then you can update the git theme as needed without impacting your custom work in the component.

That’s the simplest way, you might be duplicating some CSS but probably not an unmanageable amount.

More on themes and components: Beginner's guide to using Discourse Themes

7 Likes

I had read that and have completely fallen in love with the process. I’ll admit that until this year, I never really used Git to organize my work but I’m loving the workflow.

I had thought about using a theme component, but I had thought that it was supposed to be smaller-scale stuff on a conceptual level. Can a theme component edit the Color Scheme in any way? That feature seems exclusive to themes.

I will re-read that document again since it was late when I read it yesterday and begin to do this instead as a theme component :).

2 Likes

There’s no requirement that it is. I wouldn’t recommend copying the entire base theme and putting that in a component… that’s carrying around way more CSS than you’d need, but you can add as many overrides as you want.

Not directly, but you can create a new Color Scheme and select that as an option from the base theme’s settings. Any color scheme can be applied to any theme (how effective this is can vary based on how the theme was built).

6 Likes

Makes sense, thank you so much for taking the time to reply to me. It has been very insightful.

Sounds good.


Suggested Workflow


  • Fork and clone the theme component you want to modify
  • Open the cloned workspace with VisualStudioCode (VSC)
  • Enjoy modifying and coding your theme component
  • Push your changes from VSC up to your GitHub repo
  • Install your modified theme component from your repo
  • Test

Rinse and repeat.


3 Likes

This workflow is fine, but it might not always make sense to jump straight to a fork… especially if the original theme appears to be well-maintained. When you fork you’re more on your own if an underlying Discourse update breaks your theme.

2 Likes