Need help with theme component Github

I apologize as still a complete noob.

I am working in creating a theme component
I have imported the theme component skeleton.

I have created a javascript and added the file to

Javascript\Discourse\Initializers\Discourse_foo.js

From my understanding this file needs to be called by the script tag in header?

<script src="discours_foo.js"></script>

Looking over a few other theme components have not seen them have a file called header.css? Calling to the js scripts they are using.

Any guidance is really appreciated to improve my understanding

Thank you

This is my novice understanding, which may be helpful for your even-more-novice understanding, but is likely techically incorrect from the standpoint of someone who actually understands this stuff.

I don’t believe so. I think it just works since its’ in that initializers directory. IIRC, the skeleton includes an initializer with a console.log so that you can see it’s running.

(I think) You only need to run them in a script if you add them in an old-school done-in-the-UX theme component rather than a new school put-the-files-in-the-right-place way of doing things.

1 Like

Okay that sounds like it makes sense.

One of the ones I looked at was your hide staff

So if you don’t have any CSS required then you only need to include your JScript file in the initializers directory and fill in the about.json details?

And the component should work without anything further? (Assuming the script is good that is)

1 Like

I think that’s true. If you don’t want to add CSS, then you don’t need a CSS file. (Seems like a safe tautology.)

1 Like

Always fun learning new things/procedures.

2 Likes

these topics should help

2 Likes

Thank you very kindly Lilly. I check these out. You help us as always greatly appreciated.

1 Like