# 主题组件与插件：区别是什么

**URL:** https://meta.discourse.org/t/theme-component-v-plugin-whats-the-difference/153951
**Category:** Development
**Created:** [2020年六月5日 14:56 UTC](https://meta.discourse.org/t/theme-component-v-plugin-whats-the-difference/153951 "2020-06-05T14:56:51Z")
**Posts on this page:** 1
**Showing post:** 3

<div class="post-metadata">

### Author: ![justin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/justin/32/157614_2.png) [@justin](https://meta.discourse.org/u/justin)
#### Post date: [2020年六月5日 17:46 UTC](https://meta.discourse.org/t/theme-component-v-plugin-whats-the-difference/153951/3 "2020-06-05T17:46:05Z")

</div>

在 @EricGT 的回答基础上补充一点，该回答已经很好地解释了相关内容：

- 主题（theme）或主题组件本质上是一种修改 Discourse 前端 EmberJS 应用任意部分的方式。这可以简单到自定义 HTML 或 CSS，也可以复杂到添加新功能。如果出现问题，主题通常更加优雅，意味着即使某些部分无法工作，您的整个网站也不一定会瘫痪。
- 插件主要影响 Rails 服务器端应用，但也具备主题的所有功能，并能影响 EmberJS 应用，尽管实现起来更为复杂。插件故障通常不如主题那样优雅，因此如果您能用主题实现某项功能，建议优先从主题入手。但如果您需要自定义路由或存储数据，则必须使用插件。
- pluginAPI 是客户端提供的一个 API，主题或主题组件可以利用它更轻松地修改 Discourse 客户端的特定部分。

自定义网站的起点最好是主题。以下是一些资源：

[Discourse 主题设计师指南](https://meta.discourse.org/t/designers-guide-to-discourse-themes/152002)  
[Discourse 主题开发者指南](https://meta.discourse.org/t/developer-s-guide-to-discourse-themes/93648)  
[初学者使用主题创建器和主题 CLI 开始构建 Discourse 主题的指南](https://meta.discourse.org/t/beginners-guide-to-using-theme-creator-and-theme-cli-to-start-building-a-discourse-theme/108444)

---

_[View the full topic](https://meta.discourse.org/t/theme-component-v-plugin-whats-the-difference/153951)._
