Questions tagged [twirl]

The Play framework Scala template engine repackaged for stand-alone use.

146 questions
17
votes
1 answer

Use Twirl with Spring MVC

Is it possible to use Twirl with Spring MVC as the view technology? I would like to use something in place of JSP, and Apache Tiles feels cumbersome to me. Twirl the view technology for the Play Framework looks very cool, and similar to ASP.NET…
greyfox
  • 5,608
  • 15
  • 58
  • 103
17
votes
1 answer

How to escape the "@" in play framework templates?

How to escape the @ in play framework templates (view and tags)? If you add a "@" in any view in play framework it will be automatically processed by the template processor. Even if is an email address or a twitter account.
Ezequiel Gorbatik
  • 1,927
  • 1
  • 14
  • 19
14
votes
2 answers

Twirl templates cannot be seen in the code (spray application)

I have some configuration problem I can't see. I've followed the instructions provided in the latest twirl README, but the html package is undefined according to the compiler. I've included the sbt-twirl plugin in the project/plugins.sbt…
Rajish
  • 6,525
  • 3
  • 31
  • 49
11
votes
1 answer

How to get IntelliJ to recognize Play Framework *.scala.xml Templates

Has anyone gotten IntelliJ IDEA to recognize *.scala.xml twirl templates? HTML templates seem to get picked up by the IDE just fine and seem to be the only supported template out of box, but any other type of templates do not get picked up.
shinjw
  • 2,821
  • 15
  • 38
8
votes
1 answer

Scala Play template vararg HtmlContent

I have a generic template in play 2.6, that I want to pass in a variable amount of HtmlContents. I've defined the template like this (including the implicit parameter I have in case that changes anything): @(foo: String)(content: Html*)(implicit…
Nathan
  • 65,860
  • 11
  • 32
  • 47
8
votes
1 answer

Preprocessing of sbt-twirl templates

I need to preprocess some Twirl templates in my sbt project. Is it possible to define a task in build.sbt that will run before Twirl plugin compiles its templates?
tilex
  • 1,644
  • 1
  • 17
  • 32
6
votes
0 answers

Is there a way to include source positions in the rendered output of a Twirl template?

The *.scala files that are generated by Twirl include the information that binds the generated code to the lines in source templates. Is there an option to further include this information in the output of template's render function? If there isn't…
ps_ttf
  • 1,096
  • 7
  • 15
5
votes
5 answers

Using Vue.js in a Play Framework Application

If anyone has experience using Vue.js as a frontend for a Play Framework application, I'd like to know the recommended approach. My current setup is a Play application (in Java) with Models, Controllers, and DAOs for handling REST requests - this is…
eyeezzi
  • 585
  • 5
  • 18
4
votes
1 answer

Editing Play 2.8 Twirl templates in Eclipse

The same question was asked 3 years ago. However, the answer from that time is no longer valid. I have the last stable version of Debian and the last version of Eclipse (2020-03) running on it. I have a Java Play 2.8 project which sbt compiles and…
Oldboy
  • 283
  • 2
  • 11
4
votes
0 answers

Render html.scala from string val with Twirl (within a template or controller) in the play framework?

Hoping someone can help me out here... To put it simply I am trying to use twirl to evaluate the string content that I render from a separate definition the same as if it were a template, within a template. I know I can render the string val as an…
Gabe Church
  • 161
  • 1
  • 7
4
votes
1 answer

Using isProd and isDev in scala twirl templates in Play Framework 2.5

I'm migrating an Play 2.4 application to 2.5 and now play.Play.application().isProd is deprecated. I use this in various places in scala.html templates. (To decide weather or not to use minimized javascript.) It seems unreasonable to pass this in as…
Sindri Traustason
  • 4,985
  • 5
  • 44
  • 63
4
votes
0 answers

sbt intellij twirl templates

I am not sure how to get twirl templates to work with Intellij IDEA 14 My build.sbt: libraryDependencies += "com.typesafe.play" % "twirl-api_2.11" % "1.1.1" My text template: @(date: java.util.Date) hello world My call to render: …
user2302244
  • 633
  • 2
  • 8
  • 24
4
votes
1 answer

Html parameter passed to @Messages gets escaped in Play Framework

I'd like to pass a HTML text as a parameter to a message in a Twirl template, but when the template gets rendered the HTML gets escaped. For example, if my messages file has: my.message=Click {0} to proceed and my template.scala.html…
manub
  • 3,580
  • 2
  • 23
  • 33
4
votes
2 answers

How to resolve reference to twirl generated template class in Scala-IDE?

Using twirl for generating template class. Everything is working fine with sbt and the webpages are rendering. I am using Scala-IDE for development. And in the Scala-IDE the reference to the template class i.e. "html.test()", test is the template…
Biswanath
  • 8,877
  • 12
  • 41
  • 57
3
votes
1 answer

Scala 2.13: Passing an explicit array value to a Scala varargs method is deprecated

I am migrating to Scala 2.13. args: (Symbol, String)* in a Play Twirl template gives me this warning: Passing an explicit array value to a Scala varargs method is deprecated (since 2.13.0) and will result in a defensive copy; Use the more efficient…
pme
  • 11,442
  • 2
  • 35
  • 62
1
2 3
9 10