I spent half of yesterday researching this. It seems there is no standard, standalone solution. Every project I looked at rolled their own:
Lift (see @thoredge's answer) combines AST classes with string generation in a single file, here: https://github.com/lift/framework/blob/master/web/webkit/src/main/scala/net/liftweb/http/js/JsCommands.scala
How standalone and reusable might these various classes be? Just giving the code a visual onceover, it appears to me that the AST classes in JScala and s2js are standalone and could easily be borrowed by another project. The Scala-JS AST classes seem somewhat more entangled with their surroundings; Lift, even more so. (I welcome edits that improve on my informal impressions.)
How mature and battle-tested are these various projects? My informal impression is that they rank in descending order as follows: Lift, Scala-JS, JScala, s2js.
For my own project, I think I'm going to copy-and-paste the two source files from JScala and see how it goes.
P.S. I also mention, for completeness' sake:
I didn't look at Scala-GWT.
There is a Scala wrapper for StringTemplate (at least one, I seem to recall I saw more): http://software.clapper.org/scalasti/
Virtualized-scala doesn't seem to be what you need, I'd say, since that starts with Scala a Scala AST, and that's not what you seem to have.
However, if you're interested in those sort of things as well, you might want to check http://nescala.org/2013/talks#26 (by Alvaro Carrasco) as well.
©2020 All rights reserved.