twirl - Moving PlayFramework 2.4.x View Templates into a specific Package -


i'm on intellij 2.4.x , i'm trying move twirl view template specific package (not default package views.html). reason have sub project , i'd avoid clashing view names namespacing 2 sets of views differently. there anyway can that?

to avoid namespace clash add standard namespace folders layout views directory:

views +       l com +             l yourdomain +                           l yourtemplatefile.scala.html 

call controller as:

object application extends controller {   def = action {       ok( views.html.com.yourdomain.yourtemplatefile() )   } } 

see twirl (play template engine) project more details.

according documentation extensions can be: html, js, xml, or txt.

the above works fine in play 2.4 whether use play application layout or sbt maven layout described in https://playframework.com/documentation/2.4.x/anatomy

you can check sbt maven layout test in basic project play on github: psmaster1. here twirl/play templates located in src/main/twirl/views


Comments