Installa l'app console Theme CLI di Discourse per aiutarti a creare temi

La discourse Discourse Theme CLI è una gem Ruby che ti consente di utilizzare l’editor di tua scelta durante lo sviluppo di temi e componenti per Discourse. Man mano che salvi i file, la CLI aggiornerà il tema o il componente remoto e le modifiche appariranno in tempo reale!

Installazione

Per provarla, assicurati di avere installato Ruby 2.5 o una versione successiva.

Se utilizzi Windows, hai 2 opzioni:

Opzione 1: Windows Subsystem for Linux.

Windows 10 offre l’accesso a un ambiente Linux completo, che puoi utilizzare per installare ruby semplicemente con sudo apt-get install ruby, il che ti darà Ruby 2.3.

Opzione 2: Versioni precedenti di Windows

Le versioni precedenti di Windows non hanno accesso a WSL, ma puoi installare facilmente Ruby con Ruby Installer, scegliendo la versione consigliata e le impostazioni predefinite per l’installazione.

Mac OS versione 10.13.3 include Ruby 2.3 di serie, non è necessario nulla di speciale. Se stai eseguendo una versione precedente di Mac OS, considera l’utilizzo di rvm, rbenv o homebrew per installare una versione recente di ruby.


Una volta che Ruby 2.2 o successivo è in esecuzione, apri un terminale o un prompt dei comandi ed esegui:

gem install discourse_theme

Una volta installato, per saperne di più:

discourse_theme

Aggiornamento

gem update discourse_theme

Funzionalità

La CLI fornisce 3 funzioni principali:

discourse_theme new

Puoi usarla per creare rapidamente un nuovo tema con discourse_theme new YOUR_DIR_NAME

discourse_theme watch

Puoi usarla per monitorare un tema e sincronizzarlo con un sito Discourse (con aggiornamento in tempo reale) usando discourse_theme watch YOUR_DIR_NAME

Ciò significa che puoi usare il tuo editor per modificare il tuo tema e il sito si aggiornerà magicamente :unicorn: con le modifiche!

discourse_theme download

Puoi scaricare un tema esistente da Discourse usando discourse_theme download YOUR_DIR_NAME. Ti verrà quindi data l’opzione di iniziare subito a “monitorarlo”!

Credenziali

Dovrai generare una chiave API. Vai nell’area di amministrazione e genera una chiave lì.

  • :exclamation: Seleziona un “Livello utente” di Single User quando generi la chiave, non All Users.
  • :exclamation: Assicurati di spuntare Global Key, altrimenti riceverai errori 403 forbidden.

Le credenziali vengono (facoltativamente) memorizzate in ~/.discourse_theme. Le chiavi API vengono memorizzate per sito e l’URL/theme_id per ogni directory viene anche tracciato. Se in qualsiasi momento hai bisogno di modificare le tue impostazioni, aggiungi semplicemente --reset a qualsiasi comando e ti verrà chiesto di inserire nuovamente tutti i valori.

Testimonianze

“Questo strumento è davvero una GEM!” @awole20
“Questo è molto, molto buono.” @awesomerobot
“Funziona :slight_smile: E piuttosto figo. Ottimo!” @angus
“OMG. È incredibile.” @pfaffman


Questo documento è sottoposto a controllo di versione - suggerisci modifiche su github.

79 Mi Piace
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