Heliosurge
(Dan DeMontmorency)
17 سبتمبر 2024، 2:31م
1
أعتذر، ما زلت مبتدئًا تمامًا.
أنا أعمل على إنشاء مكون سمة.
لقد قمت باستيراد هيكل مكون السمة.
لقد أنشأت ملف جافاسكريبت وأضفته إلى
Javascript\Discourse\Initializers\Discourse_foo.js
حسب فهمي، يجب استدعاء هذا الملف بواسطة علامة النص البرمجي في الرأس؟
<script src="discours_foo.js"></script>
بالنظر إلى بعض مكونات السمات الأخرى، لم أرَ أنها تحتوي على ملف يسمى header.css؟ استدعاءً لنصوص الجافاسكريبت البرمجية التي يستخدمونها.
أي توجيهات ستكون موضع تقدير كبير لتحسين فهمي.
شكرا لك.
pfaffman
(Jay Pfaffman)
17 سبتمبر 2024، 2:42م
2
هذا هو فهمي المبتدئ، والذي قد يكون مفيدًا لفهمك الأكثر مبتدئًا، ولكنه على الأرجح غير صحيح تقنيًا من وجهة نظر شخص يفهم هذه الأمور بالفعل.
لا أعتقد ذلك. أعتقد أنه يعمل ببساطة لأنه موجود في دليل المبدئات. على حد علمي، يتضمن الهيكل المبدئي ملف تهيئة مع console.log حتى تتمكن من رؤية أنه قيد التشغيل.
(أعتقد) أنك تحتاج فقط إلى تشغيلها في نص برمجي إذا أضفتها في مكون سمة قديم الطراز تم إنشاؤه في واجهة المستخدم بدلاً من الطريقة الحديثة لوضع الملفات في المكان الصحيح.
إعجاب واحد (1)
Heliosurge
(Dan DeMontmorency)
17 سبتمبر 2024، 2:51م
3
حسنًا، هذا يبدو منطقيًا.
أحد الأشياء التي نظرت فيها كان إخفاء الموظفين.
لذا، إذا لم تكن بحاجة إلى أي CSS، فهل تحتاج فقط إلى تضمين ملف JScript الخاص بك في دليل المبدئات وملء تفاصيل about.json؟
وهل سيعمل المكون دون أي شيء آخر؟ (بافتراض أن النص البرمجي جيد)
إعجاب واحد (1)
pfaffman
(Jay Pfaffman)
17 سبتمبر 2024، 3:03م
4
أعتقد أن هذا صحيح. إذا كنت لا ترغب في إضافة CSS، فلن تحتاج إلى ملف CSS. (يبدو أنه تحصيل حاصل آمن.)
إعجاب واحد (1)
Heliosurge
(Dan DeMontmorency)
17 سبتمبر 2024، 3:06م
5
من الممتع دائمًا تعلم أشياء/إجراءات جديدة.
إعجابَين (2)
Lilly
(Lillian Louis)
17 سبتمبر 2024، 3:17م
6
هذه المواضيع يجب أن تساعد
Complex theme javascript can be split into multiple files, to keep things nicely organised.
To use this functionality, simply add files to the /javascripts folder in your theme directory. These files can not be edited from the Discourse UI, so you must use the Theme CLI or source the theme from git .
Javascript files are treated exactly the same as they are in core/plugins, so you should follow the same file/folder structure. Theme files are loaded after core/plugins, so if the filenames match,…
Themes and theme components are becoming steadily more powerful, and developers are getting more and more ambitious. To make things easier for developers, themes can now split their SCSS into multiple files.
When creating a new theme with the theme CLI , or sharing a theme on github , simply create a new folder called scss. Fill it with your .scss files, following any folder structure, and all the files will be available for you to import in the common / desktop / mobile SCSS sections of your t…
3 إعجابات
Heliosurge
(Dan DeMontmorency)
17 سبتمبر 2024، 3:26م
7
شكرا جزيلا لك يا ليلي. سألقي نظرة عليها. مساعدتك لنا دائما محل تقدير كبير.
إعجاب واحد (1)
system
(system)
تم إغلاقه في
17 أكتوبر 2024، 3:27م
8
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.