Html component javascript path

I’m a little confused on something. I was fiddling around with trying to create a little html component that references javascript. On a regular hand-coded site, I’d be putting a link to the javascript file at the end of the html.

Do I put my javascript in the Javascript tab in the component editor and it automatically uses that? Or how do I add the link to my file e.g ?

If I put it in the Javascript tab in the editor, is that my one true source to edit the script for all instances of the component?

I watched the videos on Creating an Element Dev Pack & Component but I dont think I necessarily want/need to create a Dev Pack

1 Like

Hey @jamorin,

Glad to hear you’re diving into Custom Components!

Yes, you can place it in there. You can also place it in the main template area and use the @portal function.

@portal(headEnd)
<!-- Code here will be transported to the bottom of the page head.-->
@endportal

Yes, it will be used in all instances of that component.

Hope that makes sense, just shout if you need more help or clarification on it. I can always do a quick video explaining more :blush: