هيكل السمات ومكونات السمات

يدعم Discourse السمات الأصلية التي يمكن استحضارها من أرشيف .tar.gz أو من مستودع git بعيد، بما في ذلك المستودعات الخاصة.

مثال على السمة موجود في: GitHub - discourse/discourse-simple-theme: Sam's simple discourse theme · GitHub

سيتم فحص مستودع git بحثًا عن التحديثات (مرة واحدة في اليوم)، أو عن طريق استخدام زر التحقق من التحديثات. عند اكتشاف تغييرات، سيتحول زر التحقق من التحديثات إلى التحديث إلى أحدث إصدار.

image

لإنشاء سمة، يجب عليك اتباع هيكل ملفات محدد. هذه هي الملفات التي يمكنك تضمينها:

about.json (إلزامي)

common/common.scss
common/header.html
common/after_header.html
common/footer.html
common/head_tag.html
common/body_tag.html
common/embedded.scss

desktop/desktop.scss
desktop/header.html
desktop/after_header.html
desktop/footer.html
desktop/head_tag.html
desktop/body_tag.html

mobile/mobile.scss
mobile/header.html
mobile/after_header.html
mobile/footer.html
mobile/head_tag.html
mobile/body_tag.html

locales/en.yml
locales/{locale}.yml

stylesheets/{anything}/{anything}/{anything}.scss

javascripts/{anything}.js
javascripts/{anything}.gjs
javascripts/{anything}.hbs

assets/{asset_filename}

settings.yml

أي من هذه الملفات :arrow_up: اختياري، لذا أنت بحاجة فقط إلى إنشاء الملفات التي تحتاجها.

تلك الذين يبحثون عن تقسيم SCSS الخاص بالسمة إلى ملفات متعددة، أصبح ذلك ممكنًا الآن.

تلك الذين يبحثون عن تقسيم السمة إلى ملفات JS متعددة، ما عليك سوى إضافة ملفات JS التي تريدها إلى مجلد javascripts.

هيكل ملف about.json أدناه، ويمكنك الاطلاع على مزيد من المعلومات حوله في https://meta.discourse.org/t/adding-metadata-to-a-theme/119205:

{
  "name": "My Theme",
  "component": false,
  "license_url": null,
  "about_url": null,
  "authors": null,
  "theme_version": null,
  "minimum_discourse_version": null,
  "maximum_discourse_version": null,
  "assets": {
    "variable-name": "assets/my-asset.jpg"
  },
  "color_schemes": {
    "My Color Scheme": {
      "primary": "222222"
    }
  },
  "screenshots": ["screenshots/light.jpeg", "screenshots/dark.jpeg"]
}

تعليمات حول كيفية إضافة الإعدادات إلى سمتك متاحة هنا: Add settings to your Discourse theme.

لإبلاغ Discourse أنك ستضيف مكوّن سمة وليس سمة كاملة، ما عليك سوى إضافة السطر "component": true إلى ملف about.json

يتطابق هيكل الملفات مع CSS / HTML المخصص للسمة.

قراءة إضافية

اطّلع على المقالات الأخرى الموسومة بوسم #themes::tag.

:information_source: راجع أيضًا:


آخر مراجعة بواسطة @SaraDev في 2022-08-15T21:00:00Z


هذا المستند مُدار بإصدارات - اقترح تغييرات على github.

62 إعجابًا
Alien Night Theme - A free Dark Theme for Discourse
Override values for auto-generated color variables
How to modify the header HTML, but still remaining the default founctions
Custom user fields show on Activity, but not Summary page
Some basic questions about discourse and rails
Create and share a font theme component
Add support for theme settings
How do I get started with Discourse development as a regular end user with no programming experience?
Color Scheme Contest (with Prizes!)
Custom assets upload folder?
Designer's Guide to getting started with themes in Discourse
Create and share a color scheme
Theme Developer Quick Reference Guide
Adding metadata and screenshots to a Theme
Theme Developer Tutorial: 2. Creating a remote theme
Mobile View Loading different HTML as compared to Desktop
Developing Discourse Themes & Theme Components
Minimizing Maintenance on Theme Customizations
Need help with theme component Github
Challenges creating a custom color palette
Allow users to select new color palettes
Split up theme SCSS into multiple files
Push to digital ocean from command line and rebuild
Battle Axe - A free theme by the Tappara.co hockey community
Beginner's guide to using Discourse Themes
Discourse deployment using github or bitbucket?
How to remove sticky top bar?
Do you have original customisations?
Add custom content that only appears on your homepage
Highlight color
Timefuser Theme
Compact member list
Understanding the development/deployment process
CSS Theme Contest (with Prizes!)
How to bring in Latest topics when using category boxes
Need to include PGN (chess game notation) in a post
Custom header colour and category icons and login button
Automatic dark mode for embedded comments as well?
Add settings to your Discourse theme