Heliosurge is seeking guidance on creating a theme component in Discourse. They have imported the theme component skeleton and created a JavaScript file in Javascript\Discourse\Initializers\Discourse_foo.js.
Pfaffman clarifies that the JavaScript file does not need to be called by a script tag in the header, as it will work automatically since it’s in the initializers directory. Heliosurge confirms this understanding and notes that if no CSS is required, only the JavaScript file and about.json details are needed for the component to work.
Lilly provides helpful links to Discourse theme development resources, including a quick reference guide, theme structure, and guides on splitting up JavaScript and SCSS files. Heliosurge expresses gratitude for the assistance.
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.
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)