No need to get into a debate about including JS or CSS in a file or call it externally or use a template or not. That has been argued to death as far I know.
I have working code using html_writer. And it is staying that way given I now have to rewrite/compile someone else's JS (ie Raty) just to satisfy a purist's MVC wants.
But thanks for your help.