Get started with Theme Creator and the Theme CLI

This topic will walk you through how to use the Theme CLI with our Theme Creator site to develop a theme and preview your changes on a live Discourse site.

  1. Sign up for an account here on Meta if you haven’t already

  2. Log in to Theme Creator

  3. Install the Theme CLI via the instructions here

  4. Create a new theme on Theme Creator by:

  5. Click advanced, then edit locally, and retrieve API key.

    Copy the API key that is generated.

  1. Go back to your command line and type discourse_theme download example-folder, where example-folder is where your theme will be stored locally. Follow the prompts.

    • Enter https://discourse.theme-creator.io as the root URL of your Discourse site.

    • Enter your API key from the previous step when prompted.

    • Continue following the prompts and select the theme you created in step 4.

    • Enter yes when asked if you’d like to start watching your theme.

  2. Now your local theme folder is being watched for changes, which will be automatically uploaded to Theme Creator. You can open a preview of your theme by clicking preview in your theme’s settings on Theme Creator.

  3. To stop watching for changes, hit ctrl + c in your command line window. To start watching for changes again type discourse_theme watch example-theme.

:tada: You now have a local theme directory you can edit and see your changes live!

For an in-depth look at how themes are structured and what you can do, check out our Developing Discourse Themes & Theme Components


This document is version controlled - suggest changes on github.

42개의 좋아요

안녕하세요. 이 지침을 따르려는데 계속 막혀 있습니다. API 키를 추가한 후 다음과 같은 오류가 발생합니다:

/usr/local/lib/ruby/gems/3.2.0/gems/discourse_theme-0.7.3/lib/discourse_theme/cli.rb:100:in `run': undefined method `exists?' for Dir:Class (NoMethodError)

        FileUtils.mkdir_p dir unless Dir.exists?(dir)
                                        ^^^^^^^^
Did you mean?  exist?
	from /usr/local/lib/ruby/gems/3.2.0/gems/discourse_theme-0.7.3/bin/discourse_theme:6:in `<top (required)>'
	from /usr/local/lib/ruby/gems/3.2.0/bin/discourse_theme:25:in `load'
	from /usr/local/lib/ruby/gems/3.2.0/bin/discourse_theme:25:in `<main>'

원인이 무엇일지 혹시 아시는 분 계신가요?
감사합니다.

1개의 좋아요

안녕하세요!
이 도구는 언어 변경 사항으로 인해 아직 Ruby 3.2를 지원하지 않습니다. 수정 작업을 진행 중이며, 그 동안은 Ruby 3.1.x 버전을 사용하실 수 있습니다.

6개의 좋아요

아, 그래서 그런 거였군요.
감사합니다 :slight_smile:

1개의 좋아요

이제 수정되었습니다 - discourse_theme는 gem 버전 0.7.4 이상에서 Ruby 3.2.x 환경에서 정상적으로 작동합니다 :slight_smile:

3개의 좋아요

와, 정말 빠르셨네요 :open_mouth:
감사합니다. 제 라인 매니저의 도움으로 결국 동작하게 만들었는데, 그가 이렇게 제안했어요:

rbenv install 3.1.3
rbenv shell 3.1.3
gem install discourse_theme

사실 이대로는 작동하지 않았고, 터미널 탭을 닫았다가 다시 여니까야 드디어 성공했습니다.

discourse_theme watch가 더 이상 실시간 재로드(live-reload)를 하지 않는 건가요? 예전에는 테마를 저장하면 자동으로 새로고침이 되었는데, 지금은 탭을 수동으로 새로고침해야 합니다. 콘솔에 원인을 가리키는 내용이 아무것도 없습니다.

1개의 좋아요

며칠 전에 변경 사항이 있었습니다.

Live Reload in Production 에도 관심이 있으실 수 있습니다.

4개의 좋아요

https://discourse.theme-creator.io/ 에서 제 테마를 올바르게 미리 보는 방법을 이해하려고 합니다.

discourse_theme watch는 정상 작동하며, 제 변경 사항이 미리보기 URL에 동기화되고 있습니다. about.jsoncolor_schemes를 추가한 테마를 스캐폴딩했습니다. /me/theme의 테마 선택 상자에는 해당 스킴이 표시되지만, 실제로 스킴/팔레트를 선택하여 볼 수 없고, 제가 직접 지정하지 않은 기본 스킴인 "Light"에 고정되어 있습니다.

about.json에서 정의한 명명된 색상 스킴은 /me/preferences/interface에도 표시되지 않습니다.

무엇이 잘못되었나요?

감사합니다!