Jeremy,
Today I had to figure this out and I can tell you how I did it.
First, put custom javascript file in theme/javascript folder.
https://github.com/dbnschools/moodle-theme_fordson/tree/master/javascript
Then call it in the theme layout file. In this case I also had to use jquery as seen below.
https://github.com/dbnschools/moodle-theme_fordson/blob/master/layout/frontpage.php#L71-L72
Then it just seemed to work. This was just to make a "back to top" scroll button appear. I did not use the mustache template and i don't know how I would have done it differently.
This worked for me and maybe it will help you. The 3.3 version of Academi also calls some custom javascript so check out how they do it too.