Add theme dependencies in specification

AI-generated summary

The discussion revolves around adding theme dependencies in the Discourse specification. downey proposes adding a feature to specify child/component themes required for a theme to work correctly, avoiding manual configuration by the site admin. This feature would benefit theme authors and developers who build themes for clients.

Some users, including joebuhlig and LeoMcA, suggest adding the ability to specify a particular version/commit of the dependent theme to prevent breaking changes. joebuhlig and downey discuss the possibility of adding dependencies as links to specific commits, branches, or tags in any Git repository, not just GitHub.

vinothkannans announces that support for listing dependent theme components in the about.json file has been added, making it easier to install bundles. However, this feature currently has limitations, including only installing components on initial install and not removing installed components if they are removed from the about.json file.

bloomexperiment suggests making it possible to set default settings for bundled theme components to match the top-level theme, rather than requiring a fork of the theme component.

As a Discourse theme author, I want to be able to specify child/component themes that are required for my theme to work correctly, so the user (Discourse site admin) doesn’t have to manually go out and add/configure it.

We are working on a downstream theme to work alongside the Mozilla theme (thanks @LeoMcA!) but it’d be nice if we didn’t have to manually specify import their theme and manually link them. Could such a relationship be added to the about.json file?

11 Likes

An aside, this would also benefit developers who build themes for clients. It’s becoming a more appealing setup to use a public theme and then tweak it for the client site. But more and more often, they want their customized theme in GitHub for pulling updates and allowing multiple people to work on them. It’d be great to embed the dependency somehow.

11 Likes

Asking for advanced features like this makes me :blush:, means the system is being used

Not against building this but needs very careful testing

6 Likes

I imagine it’d also be useful for you to be able to specify a particular version/commit that the theme depends on - that way, if we completely change something you’re depending on, it won’t all suddenly break on your end.

4 Likes

Yes, good point … although makes it a bit more complex. :slight_smile:

Maybe. If you can add the dependency as a GitHub link of sorts that allows a specific commit, branch, or tag, it gets easier. But that doesn’t mean the whole feature is easy.

5 Likes

Or any non-GH Git repository :wink:

1 Like

@vinothkannans just added support for initial listing of dependent theme components, that way installing a bundle is way easier.

He will post here with more details!

1 Like

Now a list of child theme components can be specified in about.json file for top-level themes. For example

{
  "name": "Material Design Theme",
  "about_url": "https://meta.discourse.org/t/material-design-stock-theme/47142",
  "license_url": "https://github.com/discourse/material-design-stock-theme/blob/master/LICENSE.txt",
  "components": ["https://github.com/discourse/discourse-brand-header", "https://github.com/Chaboi45/Take-a-break-component"]
  .
  .
  .
}

Currently, it has below limitations

  1. All the child theme components will be installed only on the initial install.
  2. If components are removed in about.json later then it won’t remove the installed child theme component.
  3. If an installed theme component is removed manually the system won’t install it again.
  4. You can’t specify child theme components for another theme component.
5 Likes

I’m wondering if it might be considered, to make it possible to set default settings of bundled theme components.

E.g. Changing the defaults in settings.yml of Discourse Button Styles, to be particular values in order to match a top-level theme

(Currently I think you would have to fork the theme component)