Discourse 테마 CLI 콘솔 앱을 설치하여 테마를 개발하세요

discourse Discourse 테마 CLI는 Discourse 테마 및 테마 컴포넌트를 개발할 때 원하는 편집기를 사용할 수 있도록 해주는 루비(Gem)입니다. 파일을 저장하면 CLI가 원격 테마 또는 컴포넌트를 업데이트하며, 변경 사항이 실시간으로 표시됩니다!

설치

시작하려면 Ruby 2.5 이상이 설치되어 있는지 확인하세요.

Windows를 사용하는 경우 두 가지 옵션이 있습니다:

옵션 1: Windows용 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를 사용 중이라면 최신 Ruby를 설치하기 위해 rvm, rbenv 또는 homebrew를 사용하는 것을 고려해 보세요.


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에서 기존 테마를 다운로드할 수 있습니다. 이후 바로 "watch"를 시작할 수 있는 옵션이 제공됩니다!

자격 증명

API 키를 생성해야 합니다. 관리자 영역으로 이동하여 키를 생성하세요.

  • :exclamation: 키 생성 시 "User Level"을 All Users가 아닌 Single User로 선택하세요.
  • :exclamation: Global Key를 반드시 선택하지 않으면 403 forbidden 오류가 발생할 수 있습니다.

자격 증명은 (선택적으로) ~/.discourse_theme에 저장됩니다. API 키는 사이트별로 저장되며, 각 디렉토리의 URL/테마 ID도 추적됩니다. 설정을 변경해야 하는 경우, 어떤 명령어에든 --reset을 추가하면 모든 값에 대해 다시 프롬프트가 표시됩니다.

사용자 후기

“이 도구는 정말 보석(GEM)입니다!” @awole20
“정말 정말 좋습니다.” @awesomerobot
“동작합니다 :slight_smile: 그리고 꽤 멋지고 멋집니다. 좋아요!” @angus
“오 마이 갓. 믿을 수 없습니다.” @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
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
If you want to edit this theme, you must submit a change on its repository
Edit CSS/HTML editor cursor offset makes it unusable due to CSS font override
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
Remote themes not in database
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
Getting error while uploading theme
[Zotero extension +] Firefox v116 on macOS broken Discourse?
Install Discourse for development using Docker
How to install plugins without using a third-party host?
How to add a custom button in user profile card?
Import site theme via console
How are theme setting fields created?
Customisability in discourse?
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
When exporting a theme, I get a broken archive

관리자 > 사용자 지정 > 테마를 통해 업로드한 파일은 테마를 저장한 후에 사라집니다.

테마에 이미지 자산을 포함시켜 저장 후에도 지워지지 않도록 하는 방법은 무엇인가요?

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 ruby와 sudo apt-get install ruby-dev를 모두 실행해야 했습니다.
설치 지침에 이 내용을 추가할 수 있을 것 같습니다.

ruby-dev를 설치하지 않으면 오류가 발생합니까? ruby 자체만으로도 충분하므로 ruby-dev를 설치할 필요는 없습니다.

4개의 좋아요

ruby-dev를 설치하라고 알려주는 오류가 떴던 것 같은데, 만약 그런 오류가 없었으면 해당 패키지가 존재하는지 알 수 없었을 거예요.
다시 재설치를 시도해 보았지만 오류를 재현할 수 없어요. 처음에 뭔가 이상한 짓을 한 건 아닌지 모르겠네요.

2개의 좋아요

음, 정말 이상하네요. 문제가 다시 재현되면 알려 주세요.

2개의 좋아요

어제 서버를 3.5.0.beta9-dev로 업데이트했는데, 그 이후로 discourse theme gem으로 라이브 리로딩이 되지 않습니다. Gem 버전은 2.1.6입니다.

오류 같은 것은 보이지 않아서, 혹시 다른 분들도 같은 문제를 겪고 있는지 먼저 여쭤봅니다.

2개의 좋아요

스타일시트의 라이브 리로드는 테마 및/또는 Discourse 코어 업데이트 시 문제를 일으키고 있었기 때문에 프로덕션 인스턴스에 대해 비활성화되었습니다.

근본적인 이유는 스타일시트 변경이 종종 JS/HTML 변경과 연결되어 있기 때문에, 스타일시트만 라이브 로딩하는 것은 위험할 수 있습니다. 사용자는 ‘새로운’ 스타일시트를 ‘오래된’ HTML과 함께 실행하게 되며, 이로 인해 매우 이상한 경험이 발생할 수 있습니다.

라이브 로딩은 개발 모드 Discourse 인스턴스에 대해서는 여전히 활성화되어 있습니다. 이상적으로는 프로덕션 사이트 대신 개발을 위해 이를 사용해야 합니다. 스타일시트 리로드 외에도, 개발 모드 Ember는 프로덕션 모드 Ember보다 훨씬 더 친근한 에러 메시지를 제공합니다.

4개의 좋아요

꽤 큰 변경사항이네요. 공지사항이 없었다는 점이 놀랍습니다. 저는 주로 프로덕션 사이트에서만 테마 개발을 해왔거든요.

이전 동작 방식을 복원할 수 있는 사이트 설정 항목이 있으면 좋겠습니다.

6개의 좋아요

동의합니다. 저도 놀랐고, 검색을 해봐도 이 현재 스레드를 찾을 수 없었습니다. 아니면 이전 OP 날짜를 보고 무시한 걸 수도 있겠네요.

1개의 좋아요

게시물이 새 주제로 분리되었습니다: 이전 테마를 복구하는 방법

설정에서 앱(Apps) 섹션의 스크린샷을 올려주실 수 있나요? 찾을 수가 없어요.

이 키에 대한 액세스를 취소하려면 사용자 설정의 ‘앱(Apps)’ 섹션을 방문하세요.

2개의 좋아요

설정(Prefs) 하단의 보안(Security) 항목에 있습니다.

해당 문구를 다음과 같이 개선할 수 있습니다:

이 키에 대한 액세스를 취소하려면 사용자 설정의 ‘앱’ 아래 ‘보안’ 섹션을 방문하세요.

1개의 좋아요

이제 보입니다. 새로고침을 해야 표시되는 것 같네요.

1개의 좋아요