仕様にテーマ依存関係を追加

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

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

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

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

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

Or any non-GH Git repository :wink:

「いいね!」 1

@vinothkannans が依存するテーマコンポーネントの初期リスト化をサポートしました。これにより、バンドルのインストールが格段に簡単になります。

詳細は後ほどここで発表されます!

「いいね!」 1

トップレベルのテーマにおいて、about.json ファイルで子テーマコンポーネントのリストを指定できるようになりました。例を以下に示します。

{
  "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"]
  .
  .
  .
}

現在、以下の制限があります。

  1. 子テーマコンポーネントは、最初のインストール時のみインストールされます。
  2. 後から about.json からコンポーネントを削除しても、インストール済みの子テーマコンポーネントは削除されません。
  3. インストール済みのテーマコンポーネントを手動で削除した場合、システムはそれを再度インストールしません。
  4. 他のテーマコンポーネントに対して子テーマコンポーネントを指定することはできません。
「いいね!」 5

バンドルされたテーマコンポーネントのデフォルト設定を指定可能にすることは、検討されるでしょうか。

例えば、Discourse Button Stylessettings.yml 内のデフォルト値を、上位のテーマに合わせる特定の値に変更することなどです。

(現時点では、テーマコンポーネントをフォークする必要があると考えています)