Feedback on "on-discourse" javascript for setting up custom JS for each page?

Thanks so much for the reply!

I think this is partly why I’m confused, I’m having trouble finding any references to extending Discourse by adding my own JS.

When I do a duckduckgo search for “Discourse developer guide” the first link I get is a link to the github repo.

The next link is to the “Discourse Advanced Developer Install Guide.” This guide is to tell you how to set it Rails for development, but does not have any links about how to install custom JS AFAICT. I’m trying to avoid a complicate build process which is what I remember from my Rails days. I would really like to develop this JS extension code in isolation, and then put a script tag into my site. So, I really don’t want to have to setup a Rails environment locally so I can build it; maybe I’m missing the utility of that? But, I really like being able to just update a docker container which uses a theme with a few <script> tags.

The next link is a “Beginner’s guide to developing Discourse Themes” which is about developing themes, not what I need, right?

I see links to the Discourse API which is obviously not what I want.

If I search for “discourse javascript initializer” I see this link from 5 years ago: Execute JavaScript code from a plugin once after load But, that seems like I am plugging into Rails, and I feel like there should be a simpler way, and this thread also seems unresolved?

Another link to “discourse javascript initializer” suggests doing what I am doing to install the JS, but does not have suggestions on how to make sure that anytime the page content changes (either through a full page refresh or XHR “turbolinks”-ish request): How do I add an external javascript file into discourse? - Stack Overflow

Is this the discussion I should be reviewing? A versioned API for client side plugins

Or, perhaps this? At first glance I don’t understand the syntax (those annotations don’t look like JS to me, are those rails conventions?) so I’m not sure if this is what I need: Using Plugin Outlet Connectors from a Theme or Plugin