Discourse Theme CLIコンソールアプリをインストールして、テーマ作成を支援しましょう

discourse Discourse Theme CLI は、Discourse のテーマやテーマコンポーネントを開発する際に、好きなエディタを使用できるようにする Ruby gem です。ファイルを保存すると、CLI はリモートのテーマまたはコンポーネントを更新し、その変更がライブで表示されます!

インストール

試すには、Ruby 2.5 以降がインストールされていることを確認してください。

Windows の場合は、2つのオプションがあります。

オプション 1: Windows Subsystem for Linux (WSL)。

Windows 10 では完全な Linux 環境にアクセスできるため、sudo apt-get install ruby で Ruby を簡単にインストールできます。これにより Ruby 2.3 がインストールされます。

オプション 2: 旧バージョンの Windows

旧バージョンの Windows では WSL にアクセスできないため、Ruby Installer を使用して Ruby を簡単にインストールできます。インストールの際は、推奨バージョンとデフォルト設定を選択してください。

Mac OS バージョン 10.13.3 には Ruby 2.3 がプリインストールされているため、特別な設定は必要ありません。それより前のバージョンの Mac OS を実行している場合は、rvmrbenv、または homebrew を使用して最新の Ruby をインストールすることを検討してください。


Ruby 2.2 以降が動作していることを確認したら、ターミナルまたはコマンドシェルを開き、以下を実行します。

gem install discourse_theme

インストール後、詳細を確認するには以下を実行します。

discourse_theme

アップグレード

gem update discourse_theme

機能

CLI には 3 つの主な機能があります。

discourse_theme new

discourse_theme new YOUR_DIR_NAME を使用して、新しいテーマをすばやく作成できます。

discourse_theme watch

discourse_theme watch YOUR_DIR_NAME を使用して、テーマを監視し、Discourse サイトと同期(ライブリフレッシュ付き)させることができます。

これは、独自のエディタを使用してテーマを編集すると、サイトが魔法のように :unicorn: 変更を更新することを意味します!

discourse_theme download

discourse_theme download YOUR_DIR_NAME を使用して、Discourse から既存のテーマをダウンロードできます。ダウンロード後、すぐに「監視」を開始するオプションが表示されます!

認証情報

API キーを生成する必要があります。管理エリアに移動し、そこでキーを生成してください。

  • :exclamation: キーを生成する際は、「ユーザーレベル」を All Users ではなく Single User に設定してください。
  • :exclamation: Global Key にチェックを入れないと、403 forbidden エラーが発生します。

認証情報は(オプションで)~/.discourse_theme に保存されます。API キーはサイトごとに保存され、各ディレクトリの URL/theme_id も追跡されます。設定を変更する必要がある場合は、いずれかのコマンドに --reset を追加するだけで、すべての値を再度求められます。

推薦の声

“This tool is truly a GEM!” @awole20
“This is very very good.” @awesomerobot
“It’s working :slight_smile: And it’s pretty dosh garn cool. Nice!” @angus
“OMG. It’s unbelievable.” @pfaffman


このドキュメントはバージョン管理されています - 変更の提案は github で行えます。

「いいね!」 79
Theme Creator, create and show themes without installing Discourse!
CSS Theme Contest (with Prizes!)
Customizing handlebars templates
Setting up a solid workflow for custom theme development
Theme Developer Quick Reference Guide
Structure of themes and theme components
Automating Discourse Plugin Setup with `create-discourse-plugin` gem
When exporting a theme, I get a broken archive
Install Discourse for development using Docker
Developing Plugins Faster by separating the frontend into a theme component
Feedback on "on-discourse" javascript for setting up custom JS for each page?
Add settings to your Discourse theme
Get started with Theme Creator and the Theme CLI
Designer's Guide to getting started with themes in Discourse
Split up theme Javascript into multiple files
Updated Custom Header Icon: Post Data via URL
Theme Developer Tutorial: 2. Creating a remote theme
Developing Discourse Themes & Theme Components
Hiding GUI elements for new users (less overwhelming)
Add custom content that only appears on your homepage
Custom CSS/HTML
[Zotero extension +] Firefox v116 on macOS broken Discourse?
Remote themes not in database
How "difficult" is modifying/extending Discourse for a backend dev
Exporting a Theme from Staging and Importing it to the Production portal
Using Plugin Outlet Connectors from a Theme or Plugin
Downloaded component installs fine, but does not once changed/re-zipped
What are the benefits of a dev environment?
3.2.0.beta2-dev (7019dbcfe1) does not load CSS from common.scss anymore
End-to-end system testing for themes and theme components
Different CSS changes for different color schemes
Need help integrating code wrote on Edittext to the Discourse
Need help integrating code wrote on Edittext to the Discourse
How to add a custom button in user profile card?
How to easily edit my site remotely?
When to use a plugin vs theme component?
Discourse core is switching to pnpm for JS package management
Using the new custom-homepage feature
Focus the editor when title is pre-filled
Cannot put the template in the desired outlet
Is this the correct way to create a theme component?
Split up theme Javascript into multiple files
Canvas Theme Template
If you want to edit this theme, you must submit a change on its repository
Import site theme via console
How are theme setting fields created?
Customisability in discourse?
Edit CSS/HTML editor cursor offset makes it unusable due to CSS font override
Discourse Theme CLI is the bomb
Discourse 2.0.0.beta5 Release Notes
How difficult would it be to make the Discourse UI more like Flarum?
Discourse-webpack: A boilerplate for developing JS-heavy Discourse components
Import Error: about.json does not exist, or is invalid
How to Add Unique HTML Content Below Topic Body in discourse forum for Specific Topics
Reuse Discourse Hamburger Functionality
Themes - Add a description field
Create and share a font theme component
Customisability in discourse?
How to create a theme (if I am a pure end user)
Linting configuration
Linting configuration
Is it possible to use a local plugin directory with a docker install?
How to overrule a color variable for one theme only?
Can't customize text on custom button in template override using UI
Is it possible to use theme component from local folder (as plugin) - for local development?
Restrict editing of remote themes

Admin の Uploads > > Customize > > Themes で、ウォッチ中のテーマを保存すると消えてしまいます。

保存後に消えないように、テーマに画像アセットを含めるにはどうすればよいですか?

「いいね!」 2

こんにちは、ようこそ!

アセットはテーマコンポーネントに直接含める必要があります。
ルートに assets ディレクトリを作成します。
次に、about.json で宣言します。

"assets": {
  "<your_identifier>": "assets/<your_asset_filename>",
}

例はこちらで確認できます。https://github.com/MeghnaAJ/discourse-christmas-decorations。

「いいね!」 3

このツールを使用してテーマコンポーネントを生成している開発者の皆様へ:

アップグレードを推奨します! :+1:

最近のPRにより、discourse-theme-skeletonリポジトリがデフォルトのテンプレートになりました。これにより、最新の設定ファイルを利用できます!

「いいね!」 9

ありがとうございます。

トピックに「更新」セクションを追加していただけると幸いです…

これは --reset ですか、それとも rubygem update ですか?

「いいね!」 4

良いアイデアですね!OPに「アップグレード」セクションを追加しました。

gem update discourse_theme
「いいね!」 5

WSLにgemをインストールするには、sudo apt-get install rubysudo apt-get install ruby-devの両方を実行する必要がありました。
インストール手順に追加できるかもしれません。

ruby-dev をインストールしない場合、エラーが発生しますか? ruby 自体で十分なので、ruby-dev をインストールする必要はないはずです。

「いいね!」 4

ruby-dev をインストールするようにというエラーメッセージが表示されたので、そのパッケージの存在を知ることができました。しかし、再インストールを試みても再現できません。もしかしたら、初回は何かおかしな操作をしたのかもしれません。

「いいね!」 2

それは確かに奇妙ですね。問題が再び再現された場合は、お気軽にお知らせください。

「いいね!」 2

サーバーを昨日3.5.0.beta9-devにアップデートしたのですが、それ以来、Discourseテーマgemでライブリロードができなくなりました。Gemのバージョンは2.1.6です。

エラーなどは何も表示されないので、まず同じような問題が発生している人がいないか質問したいと思いました。

「いいね!」 2

本番環境では、テーマやDiscourseコアの更新時に問題が発生する可能性があるため、スタイルシートのライブリロードが無効になりました

根本的に、スタイルシートの変更はJS/HTMLの変更と密接に関連していることが多いため、スタイルシートのみのライブロードは危険です。ユーザーは「新しい」スタイルシートを「古い」HTMLに対して実行することになり、非常に奇妙な体験につながる可能性があります。

開発モードのDiscourseインスタンスでは、ライブロードは引き続き有効です。理想的には、本番サイトではなく開発に使用してください。スタイルシートのリロード以外にも、開発モードのEmberは本番モードのEmberよりもはるかにわかりやすいエラーメッセージを提供します。

「いいね!」 3

これは大きな変更ですね。告知がなかったことに驚いています。私は主に本番サイトでテーマ開発を行っていました。

以前の動作を再現するためのサイト設定があると良いかもしれません。

「いいね!」 6

確かに、これは驚きました。検索してもこのスレッドが見つからなかったか、あるいは古いOPの日付を見て無視したのかもしれません。

「いいね!」 1

投稿が新しいトピックに分割されました: 以前のテーマを復元するにはどうすればよいですか