Open JohnReedLOL opened 8 years ago
What you understand about Twirl template is correct. You can find Twirl templates in https://github.com/hussachai/play-scalajs-showcase/tree/master/example-server/app/views
You can see that in each Twirl template, there is a javascript call of a main function.
Scalatags and other Scalajs code will be compiled into module-fastopt.js, module-jsdeps.js, module-launcher.js, and module-fastopt.js.map. Those files will be included by playscalajs plugin by calling @playscalajs.html.scripts("exampleClient", "/assets")
HTML elements will be generated by DOM API via Scalatag and Scalajs-DOM.
I'm using your example and I'm confused about Scalatags/ScalaJS. For the Play Twirl templates, I understand that I can trace them back to a call to something like:
Ok(views.html.index(SharedMessages.itWorks))
I know if I see views.html.index, then there must be a twirl template named "index.scala.html" inside the "views" directory.
Where are the Scalatags being called? How are they generating HTML. Are they actually generating the HTML or is it like Javascript that is manipulating the DOM to make HTML?