# 插件中的 CSS 连接是否有任何更改？

**URL:** https://meta.discourse.org/t/are-there-any-changes-to-the-css-connection-in-the-plugins/126350
**Category:** Development
**Created:** [2019年八月20日 22:31 UTC](https://meta.discourse.org/t/are-there-any-changes-to-the-css-connection-in-the-plugins/126350 "2019-08-20T22:31:05Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Stranik](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/stranik/32/85638_2.png) [@Stranik](https://meta.discourse.org/u/Stranik)
#### Post date: [2019年八月20日 22:31 UTC](https://meta.discourse.org/t/are-there-any-changes-to-the-css-connection-in-the-plugins/126350/1 "2019-08-20T22:31:05Z")

</div>

这可能是一个本地问题，但插件中的 CSS 样式未能正确加载。

latest-release +320

```plaintext
ActionView::Template::Error (undefined method `find_plugin_css_assets' for Discourse:Module) /var/www/discourse/app/views/common/_discourse_stylesheet.html.erb:15:in `_app_views_common__discourse_styl

```

> **[Comparing 1a731dc...72c2818 · discourse/discourse](https://github.com/discourse/discourse/compare/1a731dc...72c2818#diff-a39988713b69ba584364632633296cafR157)**
>
> A platform for community discussion. Free, open, simple. - Comparing 1a731dc...72c2818 · discourse/discourse

问题是否出在插件名称中的大写字母上？

```plaintext
ActionView::Template::Error (undefined method `topics' for nil:NilClass) /var/www/discourse/plugins/Toxu-h/custom_views/list/list.erb:71:in `_plugins __oxu_h_custom_views_list_list_erb___ 43913933

```

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [2019年八月20日 23:44 UTC](https://meta.discourse.org/t/are-there-any-changes-to-the-css-connection-in-the-plugins/126350/2 "2019-08-20T23:44:21Z")

</div>

> [@Stranik](#):
>
> Toxu-h

看来是这个插件导致了问题。

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [2019年八月21日 00:44 UTC](https://meta.discourse.org/t/are-there-any-changes-to-the-css-connection-in-the-plugins/126350/3 "2019-08-21T00:44:49Z")

</div>

就像几个月前对 JS 所做的那样，CSS 现在为每个插件加载一个文件，并且不会加载已禁用插件的文件。

> <https://github.com/discourse/discourse/pull/7646>

---

<div class="post-metadata">

### Author: ![Dev\_Work](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dev_work/32/124200_2.png) [@Dev\_Work](https://meta.discourse.org/u/Dev_Work)
#### Post date: [2019年八月21日 11:54 UTC](https://meta.discourse.org/t/are-there-any-changes-to-the-css-connection-in-the-plugins/126350/4 "2019-08-21T11:54:53Z")

</div>

提交此代码后，网站上的样式无法显示，出现错误：net::ERR\_ABORTED 404

---

<div class="post-metadata">

### Author: ![Dev\_Work](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dev_work/32/124200_2.png) [@Dev\_Work](https://meta.discourse.org/u/Dev_Work)
#### Post date: [2019年八月21日 12:23 UTC](https://meta.discourse.org/t/are-there-any-changes-to-the-css-connection-in-the-plugins/126350/5 "2019-08-21T12:23:01Z")

</div>

我注册了 CSS

```plaintext
register_asset "stylesheets/styles.scss"
register_asset "stylesheets/common/custom-menu.scss"

```

现在是这样吗？

 ![Capture-79](https://global.discourse-cdn.com/meta/original/3X/5/0/50e5ec73e838af92a4789fc0fe5bebe118e360a4.png)

---

<div class="post-metadata">

### Author: ![Stranik](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/stranik/32/85638_2.png) [@Stranik](https://meta.discourse.org/u/Stranik)
#### Post date: [2019年八月21日 13:19 UTC](https://meta.discourse.org/t/are-there-any-changes-to-the-css-connection-in-the-plugins/126350/6 "2019-08-21T13:19:34Z")

</div>

就我的情况而言，错误是通过修改插件（文件夹）名称中的字母大小写来解决的。我不知道具体原因，但现在大写字母不再被识别。

这一点从以下错误中显而易见：

```plaintext

ActionView::Template::Error (undefined method `topics' for nil:NilClass) /var/www/discourse/plugins/Toxu-h/custom_views/list/list.erb:71:in `_plugins __oxu_h_custom_views_list_list_erb___ 43913933

```

`Toxu-h -> toxu-h`

---

<div class="post-metadata">

### Author: ![Dev\_Work](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dev_work/32/124200_2.png) [@Dev\_Work](https://meta.discourse.org/u/Dev_Work)
#### Post date: [2019年八月21日 13:46 UTC](https://meta.discourse.org/t/are-there-any-changes-to-the-css-connection-in-the-plugins/126350/7 "2019-08-21T13:46:59Z")

</div>

谢谢！  
这个变体有效！

---

<div class="post-metadata">

### Author: ![Dev\_Work](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dev_work/32/124200_2.png) [@Dev\_Work](https://meta.discourse.org/u/Dev_Work)
#### Post date: [2019年八月26日 11:32 UTC](https://meta.discourse.org/t/are-there-any-changes-to-the-css-connection-in-the-plugins/126350/8 "2019-08-26T11:32:00Z")

</div>

插件名称中也不能使用点号  
`toxu.h -> toxu-h 或 toxuh`
