跳转到主要内容

书籍

Discourse 开发者指南(英文原版)

Discourse 是广泛使用的开源论坛系统。本书(英文)是官方开发者指南,从本地开发环境与代码结构讲到插件与主题的开发、测试和发布,面向想定制和扩展 Discourse 的开发者。

7 章100 页更新于 1 周前

开始阅读
GPL-2.0-only

目录100

  1. 第 1 章introduction1 页
    1. 1.1IntroductionDiscourse is a modern and highly-customizable platform for building communities. This documentation is inte... 1 周前
  2. 第 2 章development environments10 页
    1. 2.1Dev ContainerDev Containers is an open standard for configuring a development environment inside a container. This almos... 1 周前
    2. 2.2GitHub CodespacesGitHub Codespaces is a very fast way to get started with Discourse development. Their free tier is good for... 1 周前
    3. 2.3Docker setupDeveloping using Docker Since Discourse runs in Docker, you should be able to run Discourse directly from y... 1 周前
    4. 2.4macOS setup:warning: This guide covers installation instructions for a macOS development environment, for production g... 1 周前
    5. 2.5Ubuntu/Debian setup:warning: This guide covers installation instructions in a development environment. For a production guide ... 1 周前
    6. 2.6Windows setup:information_source: This tutorial has been tested on Windows 10 and 11. To set up a development environmen... 1 周前
    7. 2.7Non-Docker plugins(This guide only covers non-docker dev install. For Docker dev :whale: see https://meta.discourse.org/t/beg... 1 周前
    8. 2.8Local setupSo you want to set up Discourse locally to hack on and develop with? This root guide links all the #dev-ins... 1 周前
    9. 2.9Multisite setupIt's possible to run discourse in multisite mode in development. A multisite server uses a different DB and... 1 周前
    10. 2.10Fedora setupThis guide has been tested against a fresh install of Fedora 31 and 33, but may work on older versions that... 1 周前
  3. 第 3 章code internals32 页
    1. 3.1Ember componentsIn the previous tutorial I showed how to configure both the server and the client side parts of Discourse t... 1 周前
    2. 3.2UI kitui-kit is the layer of reusable, domain-free building blocks that core, plugins, and themes compose their i... 1 周前
    3. 3.3Lint and formatDiscourse uses lefthook for git hooks, and bin/lint as the main CLI entry point for running the same check... 1 周前
    4. 3.4Run test suitesDiscourse has extensive frontend tests for core, plugins and themes. Once you have a functioning local deve... 1 周前
    5. 3.5Version compatibility📖 Background Theme and plugin developers generally want to target the latest release of Discourse, without... 1 周前
    6. 3.6Ember object ownership:warning: Importing getOwner from discourse-common/lib/get-owner is deprecated. To access e.g. services th... 1 周前
    7. 3.7JS performanceWhen working on client-side work in Discourse core/plugins/themes, it's important to consider the performan... 1 周前
    8. 3.8CI with GitHub Actions:mag: Overview To build a robust extension for Discourse, it can be wise to include Continuous Integration ... 1 周前
    9. 3.9Markdown extensionsDiscourse uses a Markdown engine called Markdown-it. Here are some dev notes that will help you either fix ... 1 周前
    10. 3.10Converting modals:information_source: If you're implementing a new Modal, check out the main docs here. This topic describes... 1 周前
    11. 3.11DModal APIDiscourse 3.1.0.beta6 ships with a brand new <DModal> component-based API. DModal is part of the UI kit a... 1 周前
    12. 3.12JS APIDiscourse's JavaScript API allows themes and plugins to make extensive customizations to the user experienc... 1 周前
    13. 3.13Plugin outlet connectorsDiscourse includes hundreds of Plugin Outlets which can be used to inject new content or replace existing c... 1 周前
    14. 3.14modifyClassFor advanced themes and plugins, Discourse offers the modifyClass system. This allows you to extend and ov... 1 周前
    15. 3.15Creating routesOver time Discourse has grown in complexity and it can be daunting for beginners to understand how data get... 1 周前
    16. 3.16Authentication methodContinuing from https://meta.discourse.org/t/future-social-authentication-improvements/94691... We are now ... 1 周前
    17. 3.17Accidental serialization of ActiveRecord modelsWe've introduced a patch to prevent the accidental serialization of ActiveRecord models without specifying ... 1 周前
    18. 3.18Overriding templatesIdeally, when customizing Discourse via themes/plugins, you should use CSS, the JavaScript Plugin API, or p... 1 周前
    19. 3.19Service objectsOverview A service is a small object that encompasses business logic for a given action. From outside, it s... 1 周前
    20. 3.20System specsBackground Rails system specs are used to simulate the actions of a real user using the app in a browser. W... 1 周前
    21. 3.21FormKitBasic Usage FormKit exposes a single component as its public API: <Form />. All other elements are yielded... 1 周前
    22. 3.22AppEvents TriggersAppEvents The AppEvent system in Discourse provides a pub/sub mechanism for handling UI updates and compone... 1 周前
    23. 3.23TransformersDiscourse core includes a number of "transformer" hooks which can be used to customize client behavior. The... 1 周前
    24. 3.24Topic List CustomizationThe topic-list is one of the most-used and most-customized user-interfaces in Discourse. There are many dif... 1 周前
    25. 3.25CSS guidelinesBackground When writing CSS classes for Discourse components, themes, or plugins, we follow a modified vari... 1 周前
    26. 3.26JS type hinting & validationDiscourse ships type information for its JavaScript code. This can provide inline documentation, autocomple... 1 周前
    27. 3.27Designing for DevicesThis document outlines the APIs used to adapt Discourse's user interface for different devices. Touch & Hov... 1 周前
    28. 3.28Designing for Responsive WidthsThis document outlines the APIs used to adapt Discourse's user interface to different widths — both the bro... 1 周前
    29. 3.29Gesture primitivesui-kit ships the input-driven gesture primitives: dragging a payload onto a target, resizing a region, and ... 1 周前
    30. 3.30Bundle splittingBy default, every javascript module in a plugin is loaded when Discourse boots. This guide describes the s... 1 周前
    31. 3.31Private modulesWhat -internals means A folder named -internals holds code that is not public API. It may be renamed, res... 1 周前
    32. 3.32Acceptance testsAutomated tests are a great way to protect your code against future regressions. Many people are familiar w... 1 周前
  4. 第 4 章plugins11 页
    1. 4.1Basic pluginBuilding a plugin in Discourse can be really simple, once you learn a couple of quirks. The goal of this po... 1 周前
    2. 4.2Plugin outletPrevious tutorial: https://meta.discourse.org/t/developing-discourse-plugins-part-1-create-a-basic-plugin/3... 1 周前
    3. 4.3Site settingsPrevious tutorial: https://meta.discourse.org/t/developing-discourse-plugins-part-2-connect-to-a-plugin-out... 1 周前
    4. 4.4Git setupPrevious tutorial: https://meta.discourse.org/t/developing-discourse-plugins-part-3-add-custom-site-setting... 1 周前
    5. 4.5Admin interfacePrevious tutorial: https://meta.discourse.org/t/developing-discourse-plugins-part-4-setup-git/31272 Sometim... 1 周前
    6. 4.6Publish your pluginPrevious tutorial: https://meta.discourse.org/t/developing-discourse-plugins-part-6-add-acceptance-tests/32... 1 周前
    7. 4.7New localesUsually the best way to add a new language to Discourse is by creating a pull request as described in "http... 1 周前
    8. 4.8Chat integrationdiscourse-chat-integration abstracts away the boilerplate for integrating Discourse with external chatroom ... 1 周前
    9. 4.9markdown-it extensionmarkdown.it the CommonMark engine used by Discourse has a wide array of plugins Header anchors, definition ... 1 周前
    10. 4.10Rails autoloadingMany plugins include lots of class definitions inside plugin.rb, or use require_relative to load ruby fil... 1 周前
    11. 4.11Acceptance testsPrevious tutorial: https://meta.discourse.org/t/developing-discourse-plugins-part-5-add-an-admin-interface/... 1 周前
  5. 第 5 章themes components34 页
    1. 5.1Developing ThemesDiscourse Themes and Theme Components can be used to customize the look, feel and functionality of Discours... 1 周前
    2. 5.2Quick referenceAs themes grow more powerful, there's more to remember about how they work. We have loads of detailed docum... 1 周前
    3. 5.3Designers guideSo you're interested in in designing your own theme for Discourse? You've arrived at the right topic :smile... 1 周前
    4. 5.4Theme CreatorThis topic will walk you through how to use the Theme CLI with our Theme Creator site to develop a theme an... 1 周前
    5. 5.5Theme CLIThe Discourse Theme CLI is a ruby gem that allows you to use your editor of choice when developing Discou... 1 周前
    6. 5.6Theme structureDiscourse supports native themes that can be sourced from a .tar.gz archive or from a remote git repositor... 1 周前
    7. 5.7Multiple JS filesComplex theme javascript can be split into multiple files, to keep things nicely organised. To use this fun... 1 周前
    8. 5.8Multiple SCSS filesThemes and theme components are becoming steadily more powerful, and developers are getting more and more a... 1 周前
    9. 5.9Theme settingsDiscourse has the ability for themes to have "settings" that can be added by theme developers to allow site... 1 周前
    10. 5.10Objects for theme settingsWe are introducing a new type: objects to the supported types for theme settings which can be used to repl... 1 周前
    11. 5.11Migrate settingsIntroduction As of Discourse version 3.2.0.beta3, Discourse themes/components can leverage a migrations fea... 1 周前
    12. 5.12Theme metadataYou can add various pieces of metadata to a theme. Some are stored in the about.json file, and some are st... 1 周前
    13. 5.13Core variablesDiscourse is incredibly customizable! The goal of this topic is to show you how make use of all the amazing... 1 周前
    14. 5.14Localizable stringsFor those looking to add custom languages and translations to a Discourse theme or theme component, they ca... 1 周前
    15. 5.15E2E testingWriting automated tests for themes is an important part of the theme development process which can help ens... 1 周前
    16. 5.16Minimizing maintenanceDiscourse is highly customizable, enabling you to modify almost any aspect of its appearance through themes... 1 周前
    17. 5.17Font sizesGlobal font-size changes The simplest way to change the font size of your entire community would be to over... 1 周前
    18. 5.18Include assetsThemes and theme components allow you to handle uploaded assets such as images and fonts. You can control w... 1 周前
    19. 5.19Custom iconsYou can replace a Discourse's default SVG icons individually or as a whole with your own custom SVG and ove... 1 周前
    20. 5.20Dark modePreviously, all colors in Discourse were stored as SCSS variables. To support automatic dark mode color sch... 1 周前
    21. 5.21Theme modifiersAs themes become more ambitious, we've been looking for ways to allow them to manipulate core server-side b... 1 周前
    22. 5.22Pseudo-elementsSo, you want to insert some text or image in your Discourse site. Regarding the text in most cases it is su... 1 周前
    23. 5.23Font componentDiscourse supports importing themes containing assets from a remote repository. This allows theme authors t... 1 周前
    24. 5.24Highlight.JS languageI've just added a hook to our HighlightJS code so now you can use the plugin API to add a custom language f... 1 周前
    25. 5.25Homepage contentA very common situation you'll find yourself in as a theme developer is the need to create content that onl... 1 周前
    26. 5.26Message formatGuidelines for Translators In Discourse all Message Format strings have a key that ends with "_MF". The Cro... 1 周前
    27. 5.27Global icon changesThis is an easy way to change a Discourse icon globally. Right click on the icon you want to change and sel... 1 周前
    28. 5.28Alternative iconsBy default, Discourse bundles icons from the excellent FontAwesome library. But there are a lot of free-to-... 1 周前
    29. 5.29Wiki post styleA quick guide to change the style of your wiki posts: Change the background color: In your /admin/customiz... 1 周前
    30. 5.30Color schemeDiscourse now supports importing color schemes from remote repository. Here I will demonstrate how you woul... 1 周前
    31. 5.31Navigation menuIf you are working on a theme for an existing site and want to preview how it will look with the sidebar or... 1 周前
    32. 5.32Post content stylesRequirements :information_source: To be able to use these tips and tricks, you need to be an administrator ... 1 周前
    33. 5.33Theme screenshots:bookmark: This guide explains how to add preview screenshots to your Discourse theme to showcase how it lo... 1 周前
    34. 5.34Themeable site settingsThemeable site settings allow a theme (not components) to override a small subset of core site settings, wh... 1 周前
  6. 第 6 章general guides5 页
    1. 6.1White-labelling mobile appsSince we released the iOS and Android apps a number of people have asked expressed interest in white labeli... 1 周前
    2. 6.2Custom automations:information_source: This is a draft, and may need some extra work. Vocabulary trigger: represents the name... 1 周前
    3. 6.3Public data dumpGiven the advent of AI and the need for large datasets on local development machines, we have pulled togeth... 1 周前
    4. 6.4AI evalsOverview The Discourse AI plugin ships a Ruby CLI under plugins/discourse-ai/evals that exercises AI featu... 1 周前
    5. 6.5AI bot via APIOverview Discourse AI exposes an admin/API endpoint for streaming an AI Agent reply over a raw chunked HTTP... 1 周前
  7. 第 7 章theme developer tutorial7 页
    1. 7.11 - IntroductionThis tutorial will teach you how to create a Discourse Theme or Theme Component from the ground up. While t... 1 周前
    2. 7.22 - Remote ThemeIn the last chapter, we created a basic theme via the Discourse admin interface. This works well enough for... 1 周前
    3. 7.33 - CSSTechnically, Discourse uses SCSS to author its stylesheets. However, we're increasingly moving towards nati... 1 周前
    4. 7.44 - OutletsDiscourse uses the Ember JS Framework for its user interface. On top of Ember, Discourse provides a number ... 1 周前
    5. 7.55 - ComponentsIn the last chapter, we explored how you can render Glimmer Components into plugin outlets, and moved our ... 1 周前
    6. 7.66 - JS APIIn the last couple of chapters, we've explored how to use the JavaScript API to render content into outlets... 1 周前
    7. 7.77 - ConclusionThis tutorial has been a whistle-stop tour through the process of creating a Discourse theme and experiment... 1 周前