If you need to treat a file as a template, then it is not static. Put it in the templates folder and render it. If the file is not dynamic, then it is static. Put it in the static folder and link to it. There is no requirement that a given type of file must be a template or a static file. Pick whichever one is necessary.
On the other hand, it is probably better to keep JS static and pass arguments to it, rather than generating different code based on different input.