تثبيت تطبيق وحدة تحكم CLI لثيم Discourse لمساعدتك في بناء الثيمات

The discourse Discourse Theme CLI is a ruby gem that allows you to use your editor of choice when developing Discourse themes and theme components. As you save files the CLI will update the remote theme or component and changes to it will appear live!

Installing

To play with it, make sure you have Ruby 2.5 or up installed.

If you are on Windows, you have 2 options:

Option 1: Windows Subsystem for Linux.

Windows 10 has access to a full Linux environment, you can use it to install ruby simply with sudo apt-get install ruby, this will give you Ruby 2.3.

Options 2: Older Windows

Older versions of Windows have no access to WSL, you can easily install Ruby with Ruby Installer, go for the recommended version and default settings for the install.

Mac OS version 10.13.3 ship with Ruby 2.3 out of the box, nothing special is needed. If you are running an earlier version of Mac OS consider using rvm, rbenv or homebrew to install a recent ruby.


Once Ruby 2.2 or later is running, open a terminal or command shell and run:

gem install discourse_theme

Once installed, to learn more about it:

discourse_theme

Upgrading

gem update discourse_theme

Features

The CLI provides 3 main functions:

discourse_theme new

You can use it to quickly create a new theme with discourse_theme new YOUR_DIR_NAME

discourse_theme watch

You can use it to monitor a theme and synchronize with a discourse site (with live refresh) using discourse_theme watch YOUR_DIR_NAME

What this means is that you can use your own editor to edit you theme and site will magically :unicorn: update with the changes!

discourse_theme download

You can download an existing theme from Discourse using discourse_theme download YOUR_DIR_NAME. You will then be given the option to start “watching” straight away!

Credentials

You will need to generate an API Key. Go to the admin area and generate a key there.

  • :exclamation: Select a “User Level” of Single User when generating the key, not All Users.
  • :exclamation: Make sure to check Global Key or you will receive 403 forbidden errors.

Credentials are (optionally) stored at ~/.discourse_theme. API keys are stored per-site, and the URL/theme_id for each directory is also tracked. If you ever need to change your settings, just add --reset to any command and you will be prompted for all values again.

Testimonials

“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


This document is version controlled - suggest changes on github.

79 إعجابًا

تحميلات عبر المسؤول >> تخصيص >> السمات تختفي بعد حفظ سمة تمت مشاهدتها.

كيف نقوم بتضمين أصول الصور في السمة حتى لا يتم مسحها بعد الانتهاء من الحفظ؟

إعجابَين (2)

أهلاً بك!

تحتاج إلى تضمين الأصول مباشرة في مكون السمة الخاص بك.
في الجذر، تقوم بإنشاء دليل assets.
ثم، تقوم بتعريفها في about.json

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

يمكنك رؤية مثال هنا GitHub - MeghnaAJ/discourse-christmas-decorations.

3 إعجابات

تنبيه سريع للمطورين الذين يستخدمون هذه الأداة لإنشاء مكونات السمات:
نشجعك على ترقيتها! :+1:

لقد قام PR حديثًا بجعل مستودع discourse-theme-skeleton هو القالب الافتراضي. سيوفر لك أحدث ملفات التكوين!

9 إعجابات

شكرا لك!
سيكون من الرائع إضافة قسم تحديث إلى الموضوع…
هل هو تحديث --reset أم تحديث rubygem؟

4 إعجابات

فكرة جيدة! لقد أضفت قسم “الترقية” إلى المنشور الأصلي

gem update discourse_theme
5 إعجابات

لتثبيت الجيم على WSL، كان عليّ تشغيل كل من
sudo apt-get install ruby و sudo apt-get install ruby-dev.
ربما يمكن إضافة ذلك إلى تعليمات التثبيت.

إذا لم تقم بتثبيت ruby-dev، فهل تحصل على خطأ؟ لا ينبغي أن يكون تثبيت ruby-dev ضروريًا بما أن ruby بحد ذاته كافٍ.

4 إعجابات

أنا متأكد من أنني تلقيت خطأ يخبرني بتثبيت ruby-dev، وإلا لما كنت أعرف بوجود الحزمة.
ولكن لا يمكنني تكراره عن طريق محاولة إعادة التثبيت. ربما فعلت شيئًا غريبًا في المرة الأولى.

إعجابَين (2)

هذا غريب بالفعل. لا تتردد في إخباري إذا كان بإمكانك إعادة إنتاج المشكلة مرة أخرى.

إعجابَين (2)

لقد قمت بتحديث الخادم الخاص بي بالأمس إلى الإصدار 3.5.0.beta9-dev ولا أحصل على إعادة تحميل مباشرة مع جوهرة سمة discourse منذ ذلك الحين. الجوهرة هي الإصدار 2.1.6.

لا أرى أي أخطاء وأشياء من هذا القبيل، لذلك أردت أن أسأل أولاً عما إذا كان أي شخص آخر لديه نفس المشكلة؟

إعجاب واحد (1)

تم تعطيل إعادة التحميل المباشر لأوراق الأنماط في مثيلات الإنتاج، لأنها كانت تسبب مشاكل عند تحديث السمات و/أو نواة Discourse.\n\nبشكل أساسي: غالبًا ما ترتبط تغييرات أوراق الأنماط بتغييرات في JavaScript/HTML، لذا فإن التحميل المباشر لأوراق الأنماط فقط محفوف بالمخاطر. ينتهي الأمر بالمستخدمين بتشغيل أوراق أنماط “جديدة” مقابل HTML “قديم”، مما قد يؤدي إلى تجارب غريبة جدًا.\n\nلا يزال التحميل المباشر ممكّنًا لمثيلات Discourse في وضع التطوير. من الناحية المثالية، يجب عليك استخدام هذا الوضع للتطوير بدلاً من موقع إنتاج. بصرف النظر عن إعادة تحميل أوراق الأنماط، يوفر وضع التطوير في Ember رسائل خطأ أكثر ودية بكثير من وضع الإنتاج في Ember.

3 إعجابات

هذا تغيير كبير. أنا متفاجئ لعدم وجود إعلان. كنت أقوم بتطوير السمات بشكل أساسي فقط على مواقع الإنتاج.

قد يكون إعداد الموقع للحصول على السلوك القديم لطيفًا.

4 إعجابات

أتفق، هذا فاجأني، ولم أتمكن من العثور على هذا الموضوع الحالي على الرغم من البحث، أو ربما رأيت تاريخ OP الأقدم وتجاهلته.