# 为本地主题推出一个“js”标签

**URL:** https://meta.discourse.org/t/introducing-a-js-tab-for-local-themes/353577
**Category:** Development
**Tags:** dev-news
**Created:** [2025年二月21日 10:47 UTC](https://meta.discourse.org/t/introducing-a-js-tab-for-local-themes/353577 "2025-02-21T10:47:15Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [2025年二月21日 10:47 UTC](https://meta.discourse.org/t/introducing-a-js-tab-for-local-themes/353577/1 "2025-02-21T10:47:15Z")

</div>

在 [最新版本的 Discourse](https://github.com/discourse/discourse/pull/31423) 中，我们在管理员主题编辑器中引入了一个新的“JS”选项卡：

 ![SCR-20250220-qhpj](https://global.discourse-cdn.com/meta/original/4X/b/1/7/b17de2f4d889a721eecd21008a23bb8138abc104.png)

在后台，这对应一个名为 `javascripts/discourse/api-initializers/theme-initializer.gjs` 的文件。

我们仍然建议大多数主题使用合适的 IDE、`discourse_theme` CLI 进行编写，并使用 git 进行版本控制。但是，我们理解这并不适合所有人，并且简单的管理员面板编写主题仍然有其存在的空间。

这一改变意味着每个人都可以转向更现代的语法，而不是旧的 `<script>` 模式。在接下来的几周内，我们将更新 #Documentation > Developer Guides 来描述更现代的 (g)js 模式。

如果您有任何问题或反馈，请告诉我们！
