Reputation: 5821
Templates from the Play! framework compile to Scala and seem to be a nice fit for a scala.js project to use for client-side templating. How hard is it to use them in a scala.js project? Since I'm very new to both Scala and sbt
, detailed instructions would be much appreciated.
Alternatively, is there any other template engine which would be better suited for use with scala.js?
Upvotes: 3
Views: 1084
Reputation: 22085
I don't think it will be possible to use Play! templates in Scala.js just yet. The problem is that compiled Play! templates refer to Play! libraries, including
import play.templates._
import play.templates.TemplateMagic._
import play.api.templates._
import play.api.templates.PlayMagic._
import play.api.i18n._
import play.api.mvc._
import play.api.data._
These are only compiled for the JVM, and I would be surprised if they can be retargeted at Scala.js trivially.
To manipulate HTML trees in Scala.js, I recommend ScalaTags. Although not strictly speaking a template library, it can be used to do the same job as a template library.
Upvotes: 2