# 嵌入资源主题

**URL:** <https://meta.discourse.org/t/embed-assets-theme/371868>\
**Category:** Support\
**Created:** [2025年六月26日 17:58 UTC](https://meta.discourse.org/t/embed-assets-theme/371868 "2025-06-26T17:58:32Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![nlambert](https://avatars.discourse-cdn.com/v4/letter/n/ecccb3/32.png) [@nlambert](https://meta.discourse.org/u/nlambert)\
**Post date:** [2025年六月27日 03:00 UTC](https://meta.discourse.org/t/embed-assets-theme/371868/3 "2025-06-27T03:00:20Z")

</div>

哦，天哪 😳 原来是 Nginx！

### 简而言之：

```bash
rm -rf /var/nginx/cache/*`

```

瞬间解决！

* * *

## 可选：禁用 Nginx 资源缓存

编辑此文件：

```plaintext
/etc/nginx/conf.d/discourse.conf

```

在大约第 243-246 行，注释掉缓存指令：

```c
      # proxy_cache one;
      # proxy_cache_key "$scheme,$host,$request_uri";
      # proxy_cache_valid 200 301 302 7d;
      # proxy_cache_bypass $bypass_cache;

```

然后重启 Nginx：

```bash
sv restart nginx

```

### 🎨 如果您正在更改配色方案…

仅编辑主题中的颜色设置**不会重新生成 `embed_[digest].css`**。要强制 Discourse 生成新的资源文件，请执行此操作：

```bash
rm tmp/stylesheet-cache/* # 或者，仅针对 embed，`rm tmp/stylesheet-cache/embed*`

```

### 🤔 `RAILS_ENV=development` 怎么样？

您可能认为设置 `RAILS_ENV: development` 会禁用缓存，但是：

- Discourse 使用的 `nginx.sample.conf` **默认启用** 缓存，无论环境如何
- 该缓存 **不与 `RAILS_ENV` 绑定** ，因此它无助于嵌入式资源缓存

因此，除非您计划完全重新配置 Nginx 层，否则只需 **手动清除缓存或禁用那些行** 即可。_准备好生产环境后，您可以恢复原状。_

### 🐢 `./launcher rebuild standalone` 怎么样？

当然，它有效。但是，如果您正在积极调整主题、测试嵌入和调整颜色…您会希望每次都比等待几分钟更快。

### 💬 有更好的开发设置或快速修复方法？请评论！

---

_[View the full topic](https://meta.discourse.org/t/embed-assets-theme/371868)._
