Установите консольное приложение Discourse Theme CLI для создания тем

discourse Discourse Theme CLI — это ruby-гем, который позволяет использовать ваш любимый редактор при разработке тем и компонентов тем для Discourse. При сохранении файлов CLI обновляет удалённую тему или компонент, и изменения сразу же отображаются на сайте!

Установка

Чтобы попробовать, убедитесь, что у вас установлен Ruby 2.5 или более новая версия.

Если вы используете Windows, у вас есть 2 варианта:

Вариант 1: Windows Subsystem for Linux.

В Windows 10 есть доступ к полноценной среде Linux, вы можете использовать её для установки ruby простой командой sudo apt-get install ruby, это даст вам Ruby 2.3.

Вариант 2: Старые версии Windows

В старых версиях Windows нет доступа к WSL, вы можете легко установить Ruby с помощью Ruby Installer, выберите рекомендуемую версию и настройки по умолчанию для установки.

В Mac OS версии 10.13.3 Ruby 2.3 предустановлена из коробки, ничего особенного не требуется. Если вы используете более раннюю версию Mac OS, рассмотрите возможность использования rvm, rbenv или 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 (с обновлением в реальном времени) с помощью discourse_theme watch YOUR_DIR_NAME

Это означает, что вы можете использовать свой собственный редактор для редактирования вашей темы, и сайт волшебным образом :unicorn: обновится с изменениями!

discourse_theme download

Вы можете скачать существующую тему из Discourse с помощью discourse_theme download YOUR_DIR_NAME. Затем у вас появится возможность сразу же начать «наблюдение»!

Учётные данные

Вам нужно будет создать API-ключ. Перейдите в административную область и создайте ключ там.

  • :exclamation: При создании ключа выберите «Уровень пользователя» Single User, а не All Users.
  • :exclamation: Убедитесь, что отмечен пункт Global Key, иначе вы получите ошибки 403 forbidden.

Учётные данные (опционально) хранятся в ~/.discourse_theme. API-ключи хранятся для каждого сайта отдельно, а также отслеживаются URL и theme_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